Question: Help with my code!!! Checkpoint1 Write a function called phoneNumberFormat that takes a string containing a ten-digit phone number (such as 5155551212) as input, convert
Help with my code!!! 


Checkpoint1 Write a function called "phoneNumberFormat" that takes a string containing a ten-digit phone number (such as 5155551212) as input, convert into a more readable string with parentheses and dashes like (515)555-1212 and display it. If the input string contains more than or less than ten characters, display an error message. Note: Steps of phoneNumberFormat function can be given as follows def phoneNumberFormat (phoneNum): 1. Let be the length of the phoneNum 2. If I does not equal 10 then, display an error message. 3. Otherwise, i. areaCode first three characters of phobeNum ii. next3digits -the substring of the next three digits of phoneNum phoneNum areaCode, close parenthesis, next3digits, dash, last4digits last4digits-the substring of the last four digits of iv. Concatenate the substrings in the order, open parenthesis, and display the result. For example, phoneNumberFormat ("5155551212") displays the string (515) 555- 1212" and phoneNumberFormat "515555") displays an error message. Save the script as "lab4_checkpointl.py" in the cs104lab4 folder
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
