I am learning python and working on exercises. One of them is to encode a voting system in order to select the best player between 23 players of a match using lists.
I use Python3
.
My code is:
players= [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
vote = 0
cont = 0
while(vote >= 0 and vote <23):
vote = input('Enter the name of the player you wish to vote for')
if (0 < vote <=24):
players[vote +1] += 1;cont +=1
else:
print('Invalid vote, try again')
I get
TypeError: '<=' is not supported between instances of 'str' and 'int'
But I have no lines, all variables are integers.
source
share