mercredi 17 juillet 2019

How can i say "if error occurs do not implement this code"

I want to write a code in python that basically says, " if error occurs while implementing int(a) print('valid character') elif no error occurs while implementing int(a) print('invalid character')." a is an input

I wanna make a simple hangman game and if the input is not a letter i want a certain message to be displayed. I tried using "if a==int()" but inputs are always a string

Aucun commentaire:

Enregistrer un commentaire