If Else Exercise
If Else Exercise
ExErcisE
if – ElsE statEmEnt
6. Write a Python program to categorize the age into child, teen, adult, or senior.
Code :
age = int(input("Enter your age: "))
if age < 13:
print("Child")
elif age < 20:
print("Teen")
elif age < 60:
print("Adult")
else:
print("Senior")
10. Write a Python program to check if the length of a password is between 8 and 16
characters.
Code :
password = input("Enter a password: ")
if 8 <= len(password) <= 16:
print("Password length is valid")
else:
print("Password length is invalid")