Example2.py
age = int(input('Enter your age: '))
if age >= 18:
print('You can join the Army')
else:
print('You're not old enough yet')
Another Selection programming construct you may come across, depending on the computer language you choose to code, is the CASE statement. Look at the following example.
Again, we are using a variable to test a condition. In this case the variable is TAXRATE. I'm sure you can figure out what this program fragment would do. It simply looks at the TAXRATE variable, and depending on the variable's value, it prints out what the matching tax on your pay would be. Note there is a DEFAULT condition, in case the TAXRATE variable is not set, or for some reason does not match the available values.