# Python3 program to find simple interest
# for given principal amount, time and
# rate of interest.
def simple_interest(p,t,r):
print('The principal is', p)
print('The time period is', t)
print('The rate of interest is',r)
si = (p * t * r)/100
print('The Simple Interest is', si)
return si
# Driver code
simple_interest(8, 6, 8)
Output
The principal is 8
The time period is 6
The rate of interest is 8
The Simple Interest is 3.84
# Python program to find the
# maximum of two numbers
def maximum(a, b):
if a >= b:
return a
else:
return b
# Driver code
a = 2
b = 4
print(maximum(a, b))
Output
4
# Python program to find Area of a circle
def findArea(r):
PI = 3.142
return PI * (r*r);
# Driver method
print("Area is %.6f" % findArea(5));
Output
Area is 78.550000
# Python Program to calculate the square root
# Note: change this value for a different result
num = 8
# To take the input from the user
#num = float(input('Enter a number: '))
num_sqrt = num ** 0.5
print('The square root of %0.3f is %0.3f'%(num ,num_sqrt))
Output
The square root of 8.000 is 2.828
Python program for printing Multiplication tables.
num = int(input ("Enter a number for the multiplication table: "))print (num, "Tables\n")# for loop to
iterate 10 times
for i in range(1, 11):
print (num, 'x', i, '=', num * i)
Check whether the given number is even or odd
num = int (input (“Enter any number to test whether it is odd or even: “)
if (num % 2) == 0:
print (“The number is even”)
else:
print (“The provided number is odd”)
Output:
Enter any number to test whether it is odd or even:
887
887 is odd.