Python-Programming-Lesson-Notes

7.1 How Many Paths?

Consider this code:

if 4 > 5:
    print('A')
elif 4 == 5:
    print('B')
elif 4 < 5:
    print('C')

Which of the following would be printed if you were to run this code? Why did you pick this answer?

  1. A
  2. B
  3. C
  4. B and C
Solution C gets printed because the first two conditions, 4 > 5 and 4 == 5, are not true, but 4 < 5 is true.

Episode 7 exercise 2