Exercise 6
Write a Python algorithm that asks the user to enter their age and display the message "you are major!" if the typed age is greater than or equal to 18 and the message "you are a minor!" if the typed age is less than 18
Solution
1 2 3 4 5 6 |
# Ask the user to type their age age = int(input("Enter your age: ")) if(age > 18): print("You are an adult!") else: print("You are a minor!") |
Younes Derfoufi
CRMEF OUJDA
1 thought on “Solution Exercise 6 display major or minor according to age in python”