49.5k views
20 votes
Identify the error in the following block of code.

for x in range(2, 6):
print(x)
A. The first line is missing quotes.
B. The first line has a spelling error.
C. The second line has a spelling error.
D. The second line needs to be indented four spaces

User Suanmeiguo
by
3.4k points

2 Answers

5 votes
D I had this question
User WaTeim
by
3.8k points
5 votes

Answer:

D.The second line needs to be indented four spaces

Step-by-step explanation:

Since the print statement is not indented, it is not part of the for loop. This means that there are no lines of code to be executed in the for loop, so this will cause an error.

User Vav
by
3.9k points