Question: using python 3.4.3 . Also the program has to include a main function. please serious programmer only.. i always rate my answers. thanks Program 2
using python 3.4.3 . Also the program has to include a main function. please serious programmer only.. i always rate my answers. thanks
Program 2 ( 20 pts) Step 1 (10 pts) is ValidPhone function PreCondition: one parameter any string Description: returns True if the string is in the form ###-###-#### OR (###)###-#### returns False otherwise NOTE: do NOT have ANY print statements in this function! Step 2 (10 pts) - Create a text file with test data that THOROUGHLY TESTS EVERY CASE. Examples to include Valid phone 701-123-9999 Too long 111-222-33334 Too short 111-222-333 First segment not all numbers: a11-222-3333, 1a1-222-3333, 11a-222-3333 First hyphen not there: 1119222-3333 Etc. So, the file should start to look like this 701-123-9999 111-222-33334 111-222-333 218-444-2339 a11-222-3333 1a1-222-3333 and so on Step 3: Read the information in the file and use the function to determine if the number was valid or invalid, and produce output as shown below: Ask the user for the name of the file. If it exists, open it and read one phone number at a time Call your function to check to ensure the entry is a valid phone number Print each phone number followed by either VALID or INVALID, depending on which is true If the entry was NOT valid, print an error message and ask them to try again Example of how the output should look. Phone # Valid or Invalid? 701-123-9999 VALID 111 -222-33334 INVALID 111 -222-333 INVALID 218-477-2339 VALID a11-222-3333 INVALID 1a1 -222-3333 INVALID and so on
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
