pin = int(input()) try: print ("PIN code is created") except ValueError : print ("Please enter a number") | Sololearn: Learn to code for FREE!
+ 1

pin = int(input()) try: print ("PIN code is created") except ValueError : print ("Please enter a number")

Pls what am I doing wrong in this code

29th Dec 2021, 11:10 AM
Abiye Iniabere
Abiye Iniabere - avatar
3 Answers
+ 5
try: pin = int(input()) except ValueError : print ("Please enter a number !") else: print("Pin is Correct !")
29th Dec 2021, 11:31 AM
Ratnapal Shende
Ratnapal Shende - avatar
+ 5
Read <pin> as string first. Do the conversion to `int` inside the `try` block.
29th Dec 2021, 11:26 AM
Ipang
+ 3
It works, thank you very much🙏. It was starting to get frustrating already
29th Dec 2021, 1:04 PM
Abiye Iniabere
Abiye Iniabere - avatar