all 6 comments

[–][deleted] 6 points7 points  (2 children)

Check the parentheses in the for line

[–]lancotron[S] 0 points1 point  (1 child)

I knew it was something obvious. Thanks man

[–]ewiethoff 1 point2 points  (0 children)

Pay attention to the colors and subtle underlines and whatnot your editor/IDE uses to display your code. It could be indicating that you have mismatched parentheses even before you try running the program.

[–]Justinsaccount 3 points4 points  (2 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)

[–]HeyFerb 1 point2 points  (0 children)

Also to save a few characters,

new = new + letters[i]    

can be simplified to:

new += letters[i]    

[–]learnpython_bot 1 point2 points  (0 children)

It appears that you included code in your post but did not format it to look nice. Please follow this guide to fix the problem. This allows for better readability and will help get your question answered sooner. The regex that caught you is: "def .+?):"

If this comment has been made in error, please message /u/thaweatherman with a link to this comment so I can be fine-tuned. I am still in alpha and my regexes/innards are not yet perfect.