Test Your Understanding

2.10. Test Your Understanding#

Question 1

Which of the following evaluates to True? Select all that apply.

  1. print(5%2 == 0)
    
  2. print(5 < 2**2)
    
  3. print(5 != 3)
    
  4. 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')
  1. Missing : at the end of line 2.

  2. The third line should not be indented.

  3. if should be spelt If with a capital i.

  4. 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