You are on page 1of 1

19BCE1298

PAC
INPUT PROCESSING OUTPUT
Enter the pan number The length of the number Average marks
entered should be 10
characters.

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")

You might also like