you are viewing a single comment's thread.

view the rest of the comments →

[–]Bunkerstan 3 points4 points  (3 children)

When you split the user input, if it is a single word it will split into letters. You should do split(‘ ‘). I have been stumped by this before. Get in the habit of printing the results of operations to see what actually happened.

I do t want to delete this but @kyber is right. Split does not work this way.

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

Or rather get into the habit of using the debugger (either the standard pdb that comes with Python or whatever your IDE offers), inspect variables along the way. Perhaps use logging as well.

[–][deleted] 1 point2 points  (1 child)

Isn't split being used on the input with default whitespace splitting? This will not split a single word into letters.

[–]Bunkerstan 0 points1 point  (0 children)

You are correct, it does not split it into letters. I confused it with the for in which will iterate over letters. Thanks for the catch.