+ 1

How can I make the user keep typing in number?

I want to make it so when the user type in a string, it will keep asking them to type in a number or an integer. https://code.sololearn.com/cu0R3eonkX6E/?ref=app

10th Feb 2020, 5:38 PM
kindon T
kindon T - avatar
4 ответов
+ 3
My favourite pattern looks about like this: while True: inp = input() if inp.isdigit(): break
10th Feb 2020, 11:11 PM
HonFu
HonFu - avatar
+ 2
https://code.sololearn.com/caib2ngcNs9x/?ref=app But it doesn't work here at SL because the user input can be entered only once.
10th Feb 2020, 6:07 PM
SergeiRom
+ 1
It is not possible on SL sorry
10th Feb 2020, 6:05 PM
Oma Falk
Oma Falk - avatar