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: "))
5;:6;:
SI = (P * R * T) / 100 +TZKX36XOTIOVGR 3狣狢狢狢
Amount = P + SI +TZKX38GZK3UL3/TZKXKYZ 3狧
+TZKX3:OSK3OT3_KGXY 3狤
print("Simple Interest:", SI) 9OSVRK3/TZKXKYZ 3狣狢狢狢
'SU[TZ36G_GHRK 3狣狣狢狢狢33
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") 5;:6;:
else: +TZKX3G3T[SHKX 3狩
print(num, "is Odd") 狩3OY35JJ
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) 5;:6;:
if b > a and b > c: +TZKX3LOXYZ3T[SHKX 3狣狤
print("Largest number is:", b) +TZKX3YKIUTJ3T[SHKX 3狦狧
if c > a and c > b: +TZKX3ZNOXJ3T[SHKX 3狥狤
:NK3RGXMKYZ3T[SHKX3OY 3狦狧
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) 5;:6;:
elif choice == 2: 狣3'XKG3UL3)OXIRK
perimeter = 2 * [Link] * r 狤36KXOSKZKX3UL3)OXIRK
print("Perimeter of Circle:", perimeter) +TZKX3_U[X3INUOIK3狣3UX3狤 3狣
else: +TZKX3XGJO[Y 3狩
print("Invalid Choice") 'XKG3UL3)OXIRK 3狣狧狥狫狥狪狢狦狢狢狤狧狪狫狫狪狧
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: 5;:6;:
if a <= b: +TZKX3LOXYZ3T[SHKX 3狥狦
print(c, a, b) +TZKX3YKIUTJ3T[SHKX 3狣狤
else: +TZKX3ZNOXJ3T[SHKX 3狤狧
print(c, b, a) 4[SHKXY3OT3GYIKTJOTM3UXJKX 3A狣狤3狤狧3狥狦C