Answer to Question #255544 in Python for Ttzaas

Question #255544

The Ministry of Home Affairs and Immigration would like to introduce an automated id number and passport generation system. The system takes into consideration the following:

  • To generate the id number it takes two last digits from the Year of birth, two digits for the month of birth plus two digits for the date of birth, then finally adds a five-digit postfix number.
  • To generate the passport is similar, the system takes the first part from the id number with the year, month and date then it adds the "P-NAM" prefix and finally adds the last two digits from the id number's five-digit postfix number

Your task is to create a program that can achieve the above requirements to assist the ministry automate it’s operations

Input

Input is a single line with the person's first name, date of birth(format YYYY-MM-DD) and five-digit postfix through keyboard input, all separated by single spaces


1
Expert's answer
2021-10-24T00:40:05-0400
import datetime
name=input("Enter your first name: ")
number=int(input("Enter the five-digit post fix number: ")) 
year=int(input("Enter the year: "))
month=int(input("Enter the month: "))
day=int(input("Enter the month: "))
string = str(number)
length = len(string)
c = int(string[length - 2: length])
stri = str(year)
leng = len(stri)
x = int(stri[leng - 2: leng])
print("Id number is: ",end="")
print(x,end="")
print(month,end="")
print(day,end="")
print(number)
print("Passport is: ",end="")
print(month,end="")
print(day,end="")
print("P-NAM",end="")
print(c)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS