# Python Functions | Functions with arguments and returning value

Functions with arguments and returning value

In this we pass arguments to the function and function also returns a value.

Examples:

Question:1
Python script to calculate and print sum of two numbers
Sol:

```#function definition
def sum1(p,q):
s=p+q
return(s)

#function calling
a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
c=sum1(a,b)
print("Sum = ",c)
```

Output:

Enter 1st no 10
Enter 2nd no 20
Sum = 30
>>>

Question:2
Python script to calculate and print square of a number
Sol:

```#function definition
def square(n):
s=n*n
return(s)

#function calling
a=int(input("Enter any no "))
b=square(a)
print("Square = ",b)
```

Output:

Enter any no 5
Square = 25
>>>

Question:3
Python script to calculate and print cube of a number
Sol:

```#function definition
def cube(n):
s=n*n*n
return(s)

#function calling
a=int(input("Enter any no "))
b=cube(a)
print("Cube = ",b)
```

Output:

Enter any no 5
Cube = 125
>>>

Important Pages Visitor Counter       