Python Exception Handling practice
Hi everyone, I'm trying to get this code to give an error for anything that isnt an integer but its not working, could anyone help? This is the question - We need to create a program that allows users to create their own PIN codes for their bank cards. Each PIN code consists of digits. Complete the program so that when the user enters a character, the program stops and outputs "Please enter a number" and when the user enters only digits, the program outputs PIN code is created". Sample Input 44a5 Sample Output Please enter a number My code is: pin = input() try: PIN=int() print('PIN code is created') except: PIN!=int() print('Please enter a number') It works for the valid PIN number entries but still prints PIN code created for the entries that contain strings. Thanks