2.10. Test Your Understanding#
Question 1
Which of the following evaluates to
True? Select all that apply.
print(5%2 == 0) print(5 < 2**2) print(5 != 3) print(3**2 == 8)Solution
Solution is locked
Question 2
What is wrong with the following code? Select all that apply.
x = 5 if x < 0 print('x is less than 0')
Missing
:at the end of line 2.The third line should not be indented.
ifshould be speltIfwith a capital i.The first line should be
x == 5.Solution
Solution is locked
Question 3
What do you think the output of the following code will be?
x = 'Python' y = 5 if y > 7: print('A') elif x != 'Python': print('B') elif y < 10 and y**2 == 25: print('C') else: print('D')Solution
Solution is locked