0% found this document useful (0 votes)
53 views1 page

Enter The Pan Number The Length of The Number Entered Should Be 10 Characters. Average Marks

The document describes an algorithm to validate a 10-character Pan number. It takes a Pan number as input, checks that it is exactly 10 characters long and in uppercase. It then validates the first 5 characters are letters, middle 4 are digits, and last character is a letter, printing "valid pan number" if all checks pass or "invalid1/invalid2" if any check fails. The code implements this algorithm by extracting substrings of the Pan number and checking data type requirements on each substring.

Uploaded by

Manav Modi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

Enter The Pan Number The Length of The Number Entered Should Be 10 Characters. Average Marks

The document describes an algorithm to validate a 10-character Pan number. It takes a Pan number as input, checks that it is exactly 10 characters long and in uppercase. It then validates the first 5 characters are letters, middle 4 are digits, and last character is a letter, printing "valid pan number" if all checks pass or "invalid1/invalid2" if any check fails. The code implements this algorithm by extracting substrings of the Pan number and checking data type requirements on each substring.

Uploaded by

Manav Modi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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