Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+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 (1 point)

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 (1 point)
edited by
+1

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 (1 point)
...