Great. One problem we had was that the user did not see anything when the condition was not met. Let's change that.
john_age = 25
user_age = input('How old are you?')
if int(user_age) > john_age:
print('You are older than John.')
print('You are not older than John.')
else block that follows an
if statement means: when the condition is not met (i.e., when the condition returns
False), do the following.
Note how the lines with
else are not indented. That's very important. The lines after
else are indented – they start with two spaces, and the actual code follows the two spaces.