Python TypeError: 'int' object is not subscriptable -


this question has answer here:

i trying create ballot system in user can input candidates names , input preference scores. program works out winner , prints result.

i getting annoying return console when run line of code.

for in range(len(winners)[i]): 

the error reads:

typeerror: 'int' object not subscriptable

(edited: code dump redacted.)

you want iterate on winners:

for in winners: 

what trying do::

for in range(len(winners)): 

will iterate through indexes, error [i] have nothing here.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -