for I loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

for I loops

Got a question on my exam, “ for I = 0 to 4 “ the question was to find logic error but this is confusing as hell and I suppose I should probably learn what it meant, can anyone help ?

15th May 2022, 8:14 PM
Rudolf Saray
2 Answers
+ 1
Are you familiar with Python syntax? Is it possible to put a range into a variable? /gen
15th May 2022, 8:33 PM
Justice
Justice - avatar
0
I don't see a logic error here. It is a syntax error for Python. "for I = 0 to 4" appears to be in BASIC language. An equivalent syntax in Python would be "for I in range(5):".
16th May 2022, 2:26 AM
Brian
Brian - avatar