Question: 1. Please use Python 2. Please show test cases typed into python and that it works. The following numbers should result in the function returning

1. Please use Python

2. Please show test cases typed into python and that it works.

The following numbers should result in the function returning Valid:

+1(913)382-9842 (913) 382-9842 913.382.9842 

9133829842 +19133829842 

The following should return Invalid:

+1{913)382-9842 +2(913)382-9842 +913-382-9842 .913.382.9842 91333829842 913a829842 19133829842 

3. Please show spacing/indentation1. Please use Python 2. Please show test cases typed into python

5. Function Three: phoneCheck Specification Phone numbers in the United States consist of 10 digits. When dialing internationally, a country code must be prepended to the 10 digits (+1 is the United States country code). When people write down numbers, they frequently place different punctuation in various locations in the number to make it easier to read (e.g., (913) 268-3527, 913.456.9632, +1 (913) 439.2195). For this MP, a valid United States phone number either has 10 digits or a leading +1' followed by 10 digits. You may assume any 10 digits can be a valid number (even though no US numbers have a 555 area code for example). The third function you will write should be called phoneCheck. Your function should take one (1) argument: a string containing a phone number. The function should return one (1) string containing either 'Valid' if the number is valid or 'Invalid' if the number is invalid. To check for validity, the function should ignore the following punctuation: open parenthesis '(; close parenthesis y; period .,; hyphen and space' '. Any other non-digit characters (i.e., anything else that is not a 0-9) should result in the number being invalid. Additionally, the function should recognize 41, as a valid country code. Therefore, a plus +'anywhere else in the number will result in the number being invalid. Additionally, valid number should have 10 digits (not counting the country code). Finally, numbers must start with either an open parenthesis (', a digit, or a +1. [Note: the numbers in the examples could be real but are unknown to me, please do not call them.]

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!