validation - How to make a program that verifies Card Security Codes in python? -
I want to create a program confirming card security code in Python (CSC, 3-digit security code on credit card) I am I want to write a simple program that checks whether a given code is valid or not. The code is valid if all three letters are entered between digits 0 and 9. If the CSC is valid, then I should say that it is a legitimate message and a different message is saying that it is not valid if the code entered does not include three digits.
I wrote the following code but I know it is wrong. How can I write it but keep it short and simple? Appreciate your help! You can check to see if the length is correct: and check to see that this is a number: raw_input ("Please enter CSC:") if the code [0] limits [0, 10] and the code [1] limits [0,10] and the code [2] range In [0,10]: Print "Thank you. We will process your order!" else: print "The verification code was not valid. Please check your credit card code again."
If len (code) == 3:
if code.isdigit ( ): Edit: Correct syntax:
if LAN (code) == 3 and code.isdigit () :
Comments
Post a Comment