Python Programs Basics
Python Programs Basics
si = (p * r * t) / 100
print("Simple Interest =", si)
print(f"Area = {area:.2f}")
print(f"Perimeter = {perimeter:.2f}")
print(f"Diameter = {diameter:.2f}")
4. Voting Eligibility
age = int(input("Enter Age: "))
nationality = input("Enter Nationality: ").lower()
5. Even or Odd
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
7. Vowel or Consonant
ch = input("Enter a character: ").lower()
if ch in 'aeiou':
print("Vowel")
elif ch.isalpha():
print("Consonant")
else:
print("Not a valid alphabet character")
tax = 0
if income > 10:
tax = (income - 10) * 0.30 + (2 * 0.20) + (3 * 0.10)
elif income > 8:
tax = (income - 8) * 0.20 + (3 * 0.10)
elif income > 5:
tax = (income - 5) * 0.10