私はPythonを学習し、演習を行っています。それらの1つは、リストを使用して試合の23人の選手の間で最優秀選手を選ぶ投票システムをコードすることです。TypeError: '<='は 'str'と 'int'のインスタンス間ではサポートされていません
私はPython3
を使用しています。
マイコード:
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')
私は
TypeError: '<=' not supported between instances of 'str' and 'int'
を取得しかし、私はここに任意の文字列を持っていない、すべての変数は整数です。
vote = int(input('Enter the name of the player you wish to vote for'))
へ