Help please lesson 42.2 python core | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help please lesson 42.2 python core

Task: We need to create a program that allows us to create our own PIN codes for bank cards. Each PIN consists of numbers. Modify the program so that when the user enters letters, the program stops and displays "Please enter a number", and when the user enters only numbers, the program displays PIN code is created ". Input example 44a5 Output example Please enter a number Code: pin = int(input()) try: print ("PIN code is created") except: print ("Please enter a number")

6th Sep 2021, 11:26 AM
Ivan
3 Answers
+ 1
try: pin=int(input()) print("PIN code is created") except: print("Please enter a number")
6th Sep 2021, 2:37 PM
jsjsshjsjs
0
Displays “please enter a number” and if it doesn’t fit, it gives an error
6th Sep 2021, 11:28 AM
Ivan
0
if the input can be converted to integer, then the pin will create (the 1st text will print), otherwise the expect case will work
6th Sep 2021, 2:38 PM
jsjsshjsjs