An Example
The following code shows how to use an if statement to check if a person is old enough to vote.
File: vote.py:
age = 33
if age < 18:
print("Sorry, you are too young!")
else:
print("You can vote!")
with result:
You can vote!
We will learn more about if statements in this chapter.