M
Matt Herzog
I want a program that loops over a list of numbers (y) and tells me whether each number in the list is less than, greater than or equal to another number (x).
In the below code, I can't get python to see that 2 is equal to 2.
x = 2
def compare():
for y in ['12', '33', '2']:
if x < y:
print x, "is less than", y
elif x > y:
print x, "is greater than", y
else:
print x, "and", y, "are equal"
compare()
In the below code, I can't get python to see that 2 is equal to 2.
x = 2
def compare():
for y in ['12', '33', '2']:
if x < y:
print x, "is less than", y
elif x > y:
print x, "is greater than", y
else:
print x, "and", y, "are equal"
compare()