0% found this document useful (0 votes)
4 views2 pages

Python Simple Interest and Number Programs

The document contains five Python programming assignments that demonstrate basic programming concepts. These include calculating simple interest, checking if a number is odd or even, finding the largest of three numbers, calculating the area or perimeter of a circle, and printing three numbers in ascending order. Each assignment includes code snippets and prompts for user input.

Uploaded by

mahijitbola1003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Python Simple Interest and Number Programs

The document contains five Python programming assignments that demonstrate basic programming concepts. These include calculating simple interest, checking if a number is odd or even, finding the largest of three numbers, calculating the area or perimeter of a circle, and printing three numbers in ascending order. Each assignment includes code snippets and prompts for user input.

Uploaded by

mahijitbola1003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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)

You might also like