Question: Write a program in Python that ask users for their last name, validate it (i.e., check it against business rules), and then display it as

Write a program in Python that ask users for their last name, validate it (i.e., check it against business rules), and then display it as confirmation with only the first letter capitalized, e.g., Smith. If the name is not valid per the business rules, the display should be an appropriate error message instead and the user should be prompted for an input until a valid input is obtained. Each of these two rules for last names as the business rules should be structured as a separate function: Names must be no longer than 20 characters but must be at least two characters. Names may have an apostrophe (e.g., ORourke) or a hyphen (e.g., Smith-Barnes) but no other punctuation, no spaces, and no numbers. For example, we dont allow Smith Jr. (has space and period) or Smith III (has space). The program should also display how many times each of the two rules was violated before a valid input was obtained.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!