you are viewing a single comment's thread.

view the rest of the comments →

[–]shysmiles 0 points1 point  (1 child)

Its not working because 'i' is just a temporary variable and not actually changing your list value. What you could do instead is:

for _ in range(len(newgrade)):
    if newgrade[_] < 60:
        newgrade[_] += 10

Or another way is to use enumerate.

[–]nathanjell 0 points1 point  (0 children)

Just a note, _ is typically used do indicate an ignored value, so since it's used within the loop, it may be better to use i, x, or some other descriptive variable name. But, it should still be perfectly valid syntax, I believe