I got two loops, the first loop checks whether the given value is an int, if so it jumps to the second loop, which checks if the given value is negative. However, if I were to give a negative int input, it would logically jump to the second loop which checks if it's negative. So in the case I put -2, integer_check will be True but if my next value will be -2.2 there won't be a integer_check since it's already True.
while (integer_check == False):
try:
integer = int(input(" :"))
except ValueError:
continue
else:
integer_check = True
while (integer < 0) and (integer_check == True):
integer = int(input(" :"))
So in case of: negative integer > negative/positive float my code breaks. Any help is greatly appreciated.
integer = True
tointeger_check = True
in theelse
in your first loop – inspectorG4dget