+ 8
Controllo Errori da input 😊
Hello everyone 😊 I'm new to programming and I wanted to ask you some suggestions about error checking. I'll explain better .. If I have a code like: print(str(input("What's your name? "))) print(int(input("How old are you? "))) How do I make sure that the user enters a number instead of does a word appear as an error message ?, and the same thing if instead it inserts a word and not a number where it does not have to indicate an error? Thank you in advance for suggestions 😊
1 Antwort
+ 7
You should refer to the lesson below. Generally, you can wrap the try/except pair around the part of code which might result in an error.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2441