All Programs

#### Basic Python Programs

Simple Python programs

#### If Condition Programs

If condition based Python Programs

#### Looping based programs

program based on for loop, while loop, range

#### Searching and Sorting

Python Searching Programs
Python Sorting Programs

# Python program to print sum of two numbers

Solution with out using functions
Solution using functions without passing arguments
Solution using functions and by passing arguments
Solution using functions and by passing arguments and returning values

## Sum of two numbers

```a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
c=a+b
print("Sum = ",c)```

Output:

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

### Solution : Using function Without Passing Arguments Program/Source Code

```#function definition

def sum():
a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
c=a+b
print("Sum = ",c)

#function calling
sum()
```

Output:

Enter 1st no 25
Enter 2nd no 63
Sum = 88
>>>

### Solution : Using function Passing Arguments Program/Source Code

```#function definition

def sum(n1,n2):
s=n1+n2
print("Sum = ",s)

#function calling
a=int(input("Enter 1st no "))
b=int(input("Enter 2nd no "))
sum(a,b)
```

Output:

Enter 1st no 14
Enter 2nd no 523
Sum = 537
>>>

### Solution using functions and by passing arguments and returning values Program/Source Code

```#function definition
def sum(n1,n2):
s=n1+n2
return s

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

Output:

Enter 1st no 100
Enter 2nd no 500
Sum = 600
>>>

### Interview Questions

C Programming
C++ Programming
Basic Python Tutorial