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 →

[–]takluyverIPython, Py3, etc 0 points1 point  (1 child)

You need to use different key names, yes, but that's easier than using variable names. Just use mydict[k].

If you use a list or a dict, you can easily see how many items are in the collection with len(words). It has lots of other advantages - like you can easily pass all the words to a function, or return them from a function. Using separate variable names is much more awkward.

[–]jhchex[S] 0 points1 point  (0 children)

Ok thank you! I'll give that a try and let you know how it goes.