+ 1

How do I write a program to generate a bank card pin?

The user input must consist of four digits between 0 and 9 and will raise an exception if : 1. The digit count is not equal to 4. 2. The intended pin includes any character outside 0-9. I'd really appreciate any explanations, guidelines or other contribution.

30th Aug 2022, 3:39 AM
Kamdili Ife Darachukwu
Kamdili Ife Darachukwu - avatar
1 Resposta
+ 1
str1 = input() Kamdili Ife Darachukwu #check digit count == 4 and if all characters are numerals if len(str1)==4 and str1.isnumeric(): print("Pass") else: print("Fail")
30th Aug 2022, 4:34 AM
Bob_Li
Bob_Li - avatar