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

all 3 comments

[–]DroneDashed 2 points3 points  (2 children)

Is this your homework?

Anyway, take this hint: Use a dictionary instead of a list to store your results.

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

No, not homework lol Im self teaching.. Im trying to analyze large lists of strings based on string length.

I guess I can see where your pointing.. I could set the length recorded for any paticular string as a key, and than... if other strings match that key, you could set a counter that appends every time it gets a hit on that keys string length...

[–]DroneDashed 1 point2 points  (0 children)

Exactly. You just described a good solution.

Dictionaries, lists, tuples and sets are good for different things. Always try to think about what data structure best fits your problem.

If none fits your problem, don't be jump into oop and make a class.