Python Retry and check | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python Retry and check

Hi every one. I just wonder how take a input from user for example number check the input and if input is a string inform user about error and start function again . try: num = float(input("enter num") except: print("this is not a num try again") How to make something like goto or while is true ?

25th Jul 2018, 3:28 PM
Dawid
Dawid - avatar
2 Answers
+ 1
Use an infinite loop with return and continue statements... https://code.sololearn.com/c4eoE6ln4G3v/?ref=app
25th Jul 2018, 3:38 PM
TurtleShell
TurtleShell - avatar
0
O will check it thx
25th Jul 2018, 4:04 PM
Dawid
Dawid - avatar