Write an expression that will cause the following code to print \"18 or less\" i
ID: 3760923 • Letter: W
Question
Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only the expression.
----------------------------------------------------------------
user_age = 17
if '''Your solution goes here''':
print('18 or less')
else:
print('Over 18')
Also
Write an if-else statement for the following:
If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets to num_tickets.
Ex: if user_tickets is 3, then num_tickets = 1.
user_tickets = 0
'''Your solution goes here'''
Explanation / Answer
user_age = 17
if user_age<=18:
print('18 or less')
else:
print('Over 18')
if user_tickets<5:
num_tickets = 1
else:
num_tickets = user_tickets
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.