Reputation: 31
I keep getting the error unorderable types: list()< int(). What am i doing wrong and how should i fix it??
My code:
import sys
from List import *
def main():
strings=ArrayToList(sys.argv[1:])
numbers=ListMap(int,strings)
smallest=numbers[0]
for i in range(len(numbers)):
if numbers[i]<smallest:
smallest=numbers[i]
return smallest
print("The smallest is", smallest(numbers))
main()
The error:
Traceback (most recent call last):
File "command.py", line 18, in <module>
main()
File "command.py", line 12, in main
if numbers[i]<smallest:
TypeError: unorderable types: list() < int()
Upvotes: 2
Views: 18880
Reputation: 250961
Looks like you're trying to compare a list with an integer, this is not possible in Python3. Make sure that all items of numbers
are integers or not.
>>> [] < 1
Traceback (most recent call last):
File "<ipython-input-1-de4ae201066c>", line 1, in <module>
[] < 1
TypeError: unorderable types: list() < int()
Upvotes: 1