I want to print amessage if any one input chars (string) instead of numbers and stop my following code after this line ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to print amessage if any one input chars (string) instead of numbers and stop my following code after this line ?

https://code.sololearn.com/cgt8bpma8bYM/?ref=app

19th Feb 2020, 6:32 PM
‎Khaled Elaskry
‎Khaled Elaskry - avatar
2 Answers
+ 1
You could do it like this: if not re.match(x,degree): not ok else your logic
19th Feb 2020, 6:48 PM
Gabriel Ilie
Gabriel Ilie - avatar
0
you can check input with isdigit().
19th Feb 2020, 6:45 PM
Oma Falk
Oma Falk - avatar