Solution: Movie Night
We'll cover the following...
This program checks a user’s age and decides whether they’re old enough to watch a movie.
input()asks the user to enter their age.int()converts the input (which is text) into a number so Python can compare it.The
ifstatement checks a condition:If the user’s age is 13 or older (
age >= 13), Python runs the firstprint()statement.Otherwise, it runs the
elsepart and prints the message for users under 13.
age = int(input("How old are you? "))
if age >= 13:
print("Enjoy the movie!")
else:
print("Sorry, you're too young.")Code that checks if the user is old enough to watch a movie