+ 1
Force to input whole number in python
Hi guys, how do i force user to input whole number? Example i want someone to put their exam score in the program of course it must be whole number right? Not 16 point something. So how?
2 odpowiedzi
+ 3
while True:
inp = input()
if inp.isdigit():
break
print("you must enter a whole number")
inp = int(inp)
0
All right, thanks visph