I couldn't seem to find not 1 thing about this, most likely because I am looking in the wrong places or because it's some sort of common knowledge but I can't seem to compare 2 variables with a greater than sign (>).
My code:
counter = 0
counter2 = 0
counter3 = 0
counter4 = 0
counter5 = input("Put in a number")
counters = counter + counter2 + counter3 + counter4
(some more code that allows the user to input numbers in order to make the counters go up in value,
just ask if you need full code).
if(counter5 > counters):
print("you have input more numbers than the initial amount")
else:
print("something else")
and then so on.
My main problem is this line: if(counter5 > counters):
It completely ignores the if statement because of it and therefore it makes my if statement useless while I need it to work. Before this it also mentioned an error that said something along the lines of "cannot use (>) when comparing strings" even though I don't think I changed anything.
I don't know what I am doing wrong, I just need the first variable, if greater than the 2nd variable, to print a certain statement, and if not then print a different statement.
Aucun commentaire:
Enregistrer un commentaire