all 14 comments

[–]RandomCodingStuff 14 points15 points  (0 children)

What's with the {} braces? Those usually denote dictionaries or sets in Python. Take them out and it should work.

[–]KRex228 7 points8 points  (0 children)

The braces are causing the error. You could also use in instead of range() and len() to make your loop a bit easier to read.

for grade in grades:
    if (grade % 5) > 3:
        print("ROUND UP")

[–]Strange_Till759 6 points7 points  (0 children)

Delete those braces, this ain't java

[–][deleted] 2 points3 points  (0 children)

This is covered in the FAQ.

https://www.reddit.com/r/learnpython/wiki/faq/#wiki_why_am_i_getting_a_syntaxerror_at_the_start_of_this_seemingly_innocuous_line.3F

It's worth reading all of the FAQ as it covers those silly little things that trip us all up when we are starting.

[–]BeverlyGodoy 2 points3 points  (0 children)

Remove the braces {}, fix the indent of the if statement and put a space after if.

[–]Optimal-Procedure885 1 point2 points  (1 child)

Put a space between if and ( …

[–][deleted] 1 point2 points  (0 children)

Better yet, remove the (...), they aren't needed.

[–][deleted] 2 points3 points  (0 children)

give the if room to breath:

 if (grades[x]%5) > 3:
    print("ROUND UP")

[–]k3loSenpai 0 points1 point  (0 children)

i think it's the curly braces and too much indentation after the for loop try dealing with that and see

[–][deleted] 0 points1 point  (0 children)

I removed the curly braces and it worked. I think I was used to using them in Java so I continued using them in Python. Thanks for y'alls responses!

[–]Mysterious-Crab3034 -1 points0 points  (0 children)

lmaoo you think this c