Python Programming
June 10, 2025 at 06:44 PM
*Here are the Answers for the previous quizzes* ✅
*Q1. What is the output of the following code?*
x = 0
while x < 3:
print(x)
x += 1
✅ *Answer: A. 0 1 2*
The loop runs while x is less than 3. So it prints 0, 1, and 2 before exiting.
*Q2. What does range(1, 6) produce?*
✅ *Answer: B. [1, 2, 3, 4, 5]*
range(1, 6) includes 1 and excludes 6. So it returns 1 to 5.
*Q3. Which of the following is used to exit a loop early?*
✅ *Answer: C. break*
The break statement stops a loop immediately, even if the loop condition is still true.
*Q4. What is the output of this code?*
i = 0
while i < 3:
i += 1
print(i)
✅ *Answer: B. 1 2 3*
Since i is incremented before printing, the values printed are 1, 2, and 3.
*React with ❤️ if you're ready for the next topic*
Python Coding Challenge: https://whatsapp.com/channel/0029VaiM08SDuMRaGKd9Wv0L/1661
❤️
❤
👍
🇮🇳
🇵🇸
😂
🙏
😮
🇵🇰
😢
1.0K