0

[SOLVED] here is ValueError, but except isn't working

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

1st Jan 2022, 6:54 PM
FerutiiA1t
FerutiiA1t - avatar
3 Réponses
+ 3
Make it like this: try: pin = int(input()) print('PIN code is created') except ValueError: print ('Please enter a number')
1st Jan 2022, 7:05 PM
Paul
Paul - avatar
+ 3
You have to put the try around the input to get a value error of the input is not a number
1st Jan 2022, 7:04 PM
Kamil Hamid
Kamil Hamid - avatar
+ 2
There is no value in the try part. Which value do you want to try?
1st Jan 2022, 7:01 PM
Paul
Paul - avatar