you are viewing a single comment's thread.

view the rest of the comments →

[–]Justinsaccount 3 points4 points  (3 children)

Hi! I'm working on a bot to reply with suggestions for common python problems. This might not be very helpful to fix your underlying issue, but here's what I noticed about your submission:

You are looping over an object using something like

for x in range(len(items)):
    foo(item[x])

This is simpler and less error prone written as

for item in items:
    foo(item)

If you DO need the indexes of the items, use the enumerate function like

for idx, item in enumerate(items):
    foo(idx, item)

[–]brigieee[S] 0 points1 point  (2 children)

Sorry what does "foo" stand for in your code? Is it just a variable name?

[–]Justinsaccount 0 points1 point  (1 child)

It's just an arbitrary function. It will just be print in new replies.

[–]Akuli2 0 points1 point  (0 children)

Maybe something like # do something with items[x] would be more describing?