What will be the output of the following Python code?i = 1while True: if i%3 == 0: continue print(i) i+ =11 21 2 3errorNone of the mentioned
Question
Solution 1
The output of the given Python code will be an infinite loop.
Here's why:
- The variable
i
is initialized with the value 1. - The
while True:
statement starts an infinite loop. - Inside the loop, the
if i%3 == 0:
statement checks ifi
is divisible by 3. If it is, thecontinue
stateme Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study prob
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solv
Similar Questions
What will be the output of the following Python code?i = 1while True: if i%3 == 0: continue print(i) i+ =11 21 2 3errorNone of the mentioned
What will be the output of the following Python code?i = 1while True: if i%3 == 0: break print(i) i + = 11 2 3error1 2none of the mentioned
What will be the output of the following Python code?i = 1while True: if i%3 == 0: continue print(i) i+ =1
What will be the output of the following Python code?i = 1while True: if i%3 == 0: break print(i) i + = 1
1 pointWhat is the output of the following code?i = 1while True: if i%2 == 0: break print(i) i += 211 21 2 3 4 5 6 ...1 3 5 7 9 11 ...