Python Programming Assignment
1. Program to Calculate Amount Payable on Simple Interest
P = float(input("Enter Principal amount: "))
R = float(input("Enter Rate of Interest: "))
T = float(input("Enter Time in years: "))
SI = (P * R * T) / 100
Amount = P + SI
print("Simple Interest:", SI)
print("Total Amount Payable:", Amount)
2. Program to Check Whether a Number is Odd or Even
num = int(input("Enter a number: "))
if num % 2 == 0:
print(num, "is Even")
else:
print(num, "is Odd")
3. Program to Find the Largest of Three Numbers using Only if
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a > b and a > c:
print("Largest number is:", a)
if b > a and b > c:
print("Largest number is:", b)
if c > a and c > b:
print("Largest number is:", c)
4. Program to Display Menu for Area or Perimeter of a Circle
import math
print("1. Calculate Area of Circle")
print("2. Calculate Perimeter of Circle")
choice = int(input("Enter your choice: "))
r = float(input("Enter radius of circle: "))
if choice == 1:
area = [Link] * r * r
print("Area of Circle:", area)
elif choice == 2:
perimeter = 2 * [Link] * r
print("Perimeter of Circle:", perimeter)
else:
print("Invalid Choice")
5. Program to Print Three Numbers in Ascending Order
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a <= b and a <= c:
if b <= c:
print(a, b, c)
else:
print(a, c, b)
elif b <= a and b <= c:
if a <= c:
print(b, a, c)
else:
print(b, c, a)
else:
if a <= b:
print(c, a, b)
else:
print(c, b, a)