Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+6 votes

I was doing some hw and the project until I tried to use for i in range to repeat the code

for i in range(4)
print ('.....')

Is there anything that I miss out on or didn't include in the code that makes it run into an error every time I tried to run it

asked in CSC201 Spring 2021 by (8 points)

2 Answers

+6 votes
Best answer

You forget adding a colon (:) after numbers you want to repeat.
The full repeating code is

for i in range(4):
    print('words describing what to enter')

Hope this helps!

answered by (8 points)
edited by

Note also how it's important to INDENT the code that you want to get repeated.

+2 votes

you missed a colon(:) at the end of the first line and the print statement is supposed to be indented as it is a pat of the for loop.

answered by (8 points)