You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importre#Asking the user for the first name and checking the formatwhileTrue:
fname=input("\nPlease enter your First Name: ")
check=re.fullmatch(r"[A-Z][a-z]+", fname)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the last name and checking the formatwhileTrue:
lname=input("\nPlease enter your Last Name: ")
check=re.fullmatch(r"[A-Z][a-z]+", lname)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the date of birth and checking the formatwhileTrue:
date=input("\nPlease enter your Date of Birth (mm/dd/yyyy): ")
check=re.fullmatch(r"(0[1-9]|1[0-2])/(0[1-9]|[12]\d|3[01])/(19[0-9][0-9]|200[01])", date)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the email address and checking the formatwhileTrue:
email=input("\nPlease enter your Email Address: ")
check=re.fullmatch(r"(\w|\.)+@[a-z]+\.[a-z]{2,4}", email)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the username and checking the formatwhileTrue:
user=input("\nPlease enter your Username: ")
check=re.fullmatch(r"\w{6,12}", user)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the password and checking the formatwhileTrue:
passw=input("\nPlease enter your Password: ")
check=re.fullmatch(r"^[a-z](?=.{7,})(?=.*[A-Z])(?=.*\d)(?=.*[$&?!%])[a-zA-Z0-9$&?!%]+$", passw)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the credit card number and checking the formatwhileTrue:
ccnum=input("\nPlease enter your Credit Card Number (no spaces): ")
check=re.fullmatch(r"^(4|5)\d{15}", ccnum)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the credit card expiration date and checking the formatwhileTrue:
ccdat=input("\nPlease enter your Credit Card Expiration Date (mm/yy): ")
check=re.fullmatch(r"(0[5-9]|1[0-2])/24|(0[1-9]|1[0-2])/(2[5-9]|[3-9][0-9])", ccdat)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
break#Asking the user for the credit card verification code and checking the formatwhileTrue:
cccvc=input("\nPlease enter your Credit Card Verification Code: ")
check=re.fullmatch(r"\d{3}", cccvc)
ifcheck==None:
print("Wrong format! Please try again.")
continueelse:
breakuserinfo= ["First Name: "+fname,
"Last Name: "+lname,
"Date of birth: "+date,
"Email address: "+email,
"Username: "+user,
"Password: "+passw,
"Card number: "+ccnum,
"Expiration date: "+ccdat,
"CVC: "+cccvc]
string="\n".join(userinfo)
print(f"This is your user account information:\n\n{string}")