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!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponses
+ 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