def get_integer(maximum):
x= int(input())
while x > 0 and maximum > x:
if type(x) == type(5):
return x
Inputs that can be interpreted as int
s between 0 and the argument(maximum
), if any input isn't within range or isn't a digit it loops back.
This is what I have so far, it runs, but when given multiple inputs I get-
ValueError: invalid literal for int() with base 10
.