Question: Python problem again! 2) Write a program to convert a 7-digit numeric input into a phone number with a standard format (##########). Here are the

Python problem again!

Python problem again! 2) Write a program to convert a 7-digit numeric

2) Write a program to convert a 7-digit numeric input into a phone number with a standard format (##########). Here are the criteria: Your program "L6Q2initials.py" must start with a commented ID Box AND include a comment that indicates the purpose of the program. EACH of the four functions in your program must state its purpose in comments too. The main function in your program must be named: make_phone_num. It has been provided for you. Copy this function into your program EXACTLY as written: # Main function - Test all of the helper functions def make_phone_num (): original = get_number (O phone_num fix_phone_num (original) print _phone_nums (original , phone_num) As you can see, make_phone_num calls THREE helper functions namely: get_number (O) : Prompt the user for a 7-digit number. Error check it to ensure it is both numeric and 7 digits long. Return the input string when finished. fix_phone_num (original): Take a 7-digit string, fix it" so it becomes a proper phone number, and return the string result. The criteria for fixing' the string is explained next. The sample screenshot provided later on shows an actual numeric example. 1. Original 7-digit input string 2 Switch values in positions a and g 3. Add 780 in front of the current numbers 4. Add dashes typical to a phone # Return the 12 character string gbcdefa abcderg 780abcdefg 780-abc-defg print phone nums (original, phone_num) : Print the original input and the fixed phone number lined up vertically with descriptions as shown in the screenshot below. >>> make _phone_num () Please enter a 7-digit number: 123 The sample output provided shows you Error ! Try again : abc123 one example. Your output should be Error Try again similar in layout but reflect whatever 7 Error! Try again : abcdefg digit number was entered as input. Error! Try again: 7234561 Original input: 7234561 Fixed number: 780-123-4567

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!