[Solved] TypeError: '<=' not supported between instances of 'str' and 'int'
![](https://namespaceit.com/uploads/post/image/TypeError not supported between instances of str and int.jpg)
Problem:
I am learning python. While doing practice I was trying to create a voting system to select the best dancer in the class between 25 dancers using the list. FYI, I am using python3.
This is my code:
dancers= [0,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 <24):
vote = input('Enter the dancer you wish to vote for')
if (0 < vote <=25):
dancers[vote +1] += 1;cont +=1
else:
print('Something went wrong, try again')
And this is the error I am getting:
TypeError: '<=' not supported between instances of 'str' and 'int'
So in this article, we are going to learn how to solve this problem.
Solution:
So when you get the input from the console you are getting a string. That's why you are getting the error. To solve this you can cast that input string to an int object to do numerical operations.
Change this:
vote = input('Enter dancer you wish to vote for')
To this:
vote = int(input('Enter the dancer you wish to vote for'))
Hope this solves your problem. If you have any more questions you can comment below.