by Rhea Tortor
You task is to write a program that will continuously add friend data to a list named friends until the user enters "No". The program must display the contents of friend list.
friend's data to be collected:
Last name
First name
Birthdate
Gender
Contact No.
Validation:
Name must not be empty.
Must check the validity of the birth date.
Gender either F or M only.
Contact No. must be exactly 11 digits.
Display "Invalid input!" and ask the user to input another value.
Input
Friend's data
Tortor
Rhea
12/25/1990
F
09172345678
No
Output
Name:·Rhea·Tortor
Birthdate:·December·25,·1990
Gender:·Female
Contact·No.:·09172345678
last_name=input("Enter your Last name: ")
first_name=input("Enter your First name: ")
birth_date=input("Enter your Birth date: ")
gender=input("What is your Gender? ")
contact_no=input("Enter your contact no: ")
Y_N=input("Yes or No?")
if Y_N=='No':
print("{}\n{}\n{}\n{}\n{}".format(last_name,first_name,birth_date,gender,contact_no))
Enter your Last name: Tortor
Enter your First name: Rhea
Enter your Birth date: 12/25/1990
What is your Gender? F
Enter your contact no: 09172345678
Yes or No?No
Tortor
Rhea
12/25/1990
F
09172345678
Comments
Leave a comment