24 lines
793 B
Python
24 lines
793 B
Python
# Comparison operators: '==' equals, '!=' not equal, <, >, <=, >=, and, not
|
|
#
|
|
# Program moves top to bottom in order
|
|
#
|
|
# # Set age var
|
|
# age = 18
|
|
# # if age var is greater than or equal to 18, print string
|
|
# if age >= 18:
|
|
# print('You are an adult')
|
|
# # else, if age is greater than or equal to 13, print string (fires if conditional above it is not true)
|
|
# elif age >= 13:
|
|
# print('You are a teen')
|
|
# # Else (age is not greater than or equal to 13 or 18) print string (Fires if none of other conditionals are true)
|
|
# else:
|
|
# print('You are a child')
|
|
|
|
# Same structure, triggering elif conditional and adds formatted string
|
|
score = 72
|
|
if score >= 90:
|
|
print('A grade')
|
|
elif score >= 80 and score <90:
|
|
print('B grade')
|
|
else:
|
|
print(f'Your score of {score} needs improvement') |