Program 8— Social Security Number Validation
In this project, you will write a program to prompt the user to enter their social security number in the format ###-##-#### and then determine if the input is properly formatted. A properly formatted social security number will have:
• A length of 11
• Hyphens (“-“) in the 3rd and 6th characters - Remember you start with 0!
• There are 9 characters that are digits (0-9)
Two examples of the program in operation:
Enter your SSN: 555-55-5555
The SSN is VALID!
Enter your SSN: 55555-555
The SSN is INVALID!
A template for this project is provided with comments to help guide you as you write the program to accomplish the following steps:
1. Download the template for Program 8 and save it to a folder on your computer/flash drive.
2. View/print the following programs from the Chapter 12 course module in Blackboard as examples to follow as you complete this program:
a. Program 12-5 – shows how to check the length of a string and the number of digits in a string
b. Program 12-6 – shows how to check for symbols in specific positions within a string
3. Open the template program file.
4. Add code to the numberDigits() function so that it will return the number of digits contained in the string stored in the str parameter. See example program 12-5.
5. Add code to the isValidFormat() function so that it will return True if the SSN is properly formatted and False if it is not properly formatted. See example program 12-6.
6. Add code to the main() function that calls the other two functions and uses the results that they return to determine if the SSN is valid or invalid and print the appropriate message. See example program 12-5.
7. Debug your code and try multiple test cases to see if it works properly.
#Template for Program 8 #Complete the code as discussed in the Program 8 Instructions def main(): #Get a SSN from the user mySSN = input("Enter your SSN (###-##-####): ") #Validate the SSN and print valid/invalid #Write a function to count the number of digits in the string #Replace the word pass with your code def numberDigits(str): pass #Write a function to check if there is a hyphen "-" in the #3rd and 6th positions in the string #Replace the word pass with your code def isValidFormat(str): pass #Start by calling main main()