QuestionQ20

Control Structures and Iteration

What will the code in the screen capture output when it is executed?

Question Image

  • A 2
  • B 4
  • C x
  • D An error
Explanation

In Python, the integer value 0 is falsy, so the else block executes. It changes x from 4 to 2 and prints 2.

Community Discussion

No comments yet. Be the first to start the discussion!