Bird
0
0

Find the error in this code:

medium📝 Debug Q6 of 15
Python - For Loop
Find the error in this code:
for i in range(3)
    print(i)
AIndentation error on print
BMissing colon after range(3)
Crange should be range[3]
Dprint should be print[]
Step-by-Step Solution
Solution:
  1. Step 1: Check for syntax errors

    Python for loops require a colon ':' after the range expression.
  2. Step 2: Identify the missing colon

    The code misses ':' after 'range(3)', causing syntax error.
  3. Final Answer:

    Missing colon after range(3) -> Option B
  4. Quick Check:

    For loops need ':' after header [OK]
Quick Trick: Always put ':' after for loop header [OK]
Common Mistakes:
MISTAKES
  • Forgetting colon
  • Wrong range syntax
  • Wrong print syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes