CBSE Class 11 Informatics Practices
Question 36 of 40
Practice Paper — Question 1
Back to all questions30=y #Error 1
for i in range (2, 6) #Error 2
print(true) #Error 3
else:
print ("Loop over") #Error 4Error 1 — This is an invalid assignment statement. The variable should be on the left side.
Error 2 — The for loop header is missing a colon at the end.
Error 3 — 'true' should be 'True' to be a valid boolean value in Python.
Error 4 — The else block is not properly indented.
The corrected code is:
y = 30
for i in range(2, 6):
print(True)
else:
print("Loop over")