PCEP 30 02 PCEP Certified Entry Level Python Programmer · Free Practice Question Easy
Question 21
What is the output of the following code snippet?
- i = 0
- while i < 2:
- i += 1
- if i == 1:
- print('Hi')
- pass
- print(i)
-
A
0
-
B
Hi
1
-
C
Hi
-
D
Hi
1
2
Reveal correct answer
Correct answer: D
Explanation
pass will execute the next statement. It will just pass the control to the next statement. In this case, it is - print(i)
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
