1. Write a python program to add two numbers.
A:-
# Store input numbers
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
# Add two numbers
sum = float(num1) + float(num2)
# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))
Output:-
Enter first number: 1.5
Enter second number: 6.3
The sum of 1.5 and 6.3 is 7.8
2. Write a python program to find simple interest.
A:-
P = float(input("Enter the principal amount : "))
N = float(input("Enter the number of years : "))
R = float(input("Enter the rate of interest : "))
#2
SI = (P * N * R)/100
print("Simple interest : {}".format(SI))
Output:-
Enter the principle amount : 100
Enter the number of years : 5
Enter the rate of interest : 5
Simple interest : 25.0
3. Write a python program to find the area of a circle.
A:-
# Python Program to find Area Of Circle using Radius
PI = 3.14
radius = float(input(' Please Enter the radius of a circle: '))
area = PI * radius * radius
print(" Area Of a Circle = %.2f" %area)
OutPut:-
Please Enter the radius of a circle:6
Area Of a Circle = 113.04
4. Write a python program to check whether a number is even or odd.
A:-
a=int(input("Please Enter a Number : "));
if(a%2==0):
print("This Number is Even")
else:
print("This Number is Odd")
Output:-
Please enter a number : 18
This number is Even
5. Write a python program to check Leap year.
A:-
year = int(input("Enter a year: "))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
Output : -
Enter year-2011
2011 is not a leap year