Title | 14082019 - PYTHON CODE FOR PAN NUMBER |
---|---|
Course | Problem solving and Programming |
Institution | Vellore Institute of Technology |
Pages | 1 |
File Size | 68.1 KB |
File Type | |
Total Downloads | 64 |
Total Views | 153 |
PYTHON CODE FOR PAN NUMBER...
19BCE1298 PAC INPUT Enter the pan number
PROCESSING
OUTPUT
The length of the number entered should be 10 characters.
Average marks
ALGORITHM STEP1: Enter the pan number STEP2:check the length of string should be 10 characters STEP3:check the string characters are all in uppercase. STEP4: extract first 5 characters from the string entered and check whether it is all alphabets. STEP5: extract next 4 characters from the string entered and check whether it is all digits. STEP6: extract last character from the string entered and check whether it is an alphabet.
CODE
pan=input("enter your pan number:") y=pan[0:5] x=pan[9:10] t=pan[5:9] if len(pan)==10: if pan.isupper()==True and y.isalpha()==True and x.isalpha()==True and t.isdigit()==True: print("valid pan number") else : print("invalid1") else : print("invalid2")...