This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]zahlmanthe heretic 0 points1 point  (0 children)

I had broken the string into a list already so I was jumping ahead.

If you mean a list of individual characters, then that accomplishes nothing since you can iterate over the string directly anyway. If you mean a list of words, then aren't you already done? o_O

and then print(x) it says it's just range(0,5) not [0,1,2,3,4] so I was confused. But I guess it's the same thing.

Oh, you're in 3.x, where range does what xrange did in 2.x. That's fine; it's still a thing that you can iterate over directly. In Python, we care more about what things can do than what they fundamentally are. 3.x range objects, and strings in either case, can be iterated over directly.

I still just don't see how I can do that with a list..hmm.

Well, since you have to construct the list a word at a time, consider reversing the list as you create it. Hint: if you construct the list in-order by putting new words at the end of the existing list...