A function that accepts a user input phone number string type and returns a normalized United States phone number string type in E.164 format. Return null (or an equivalent value) if the user input phone number is invalid
Python 100.00%
e.164-formatter's Introduction
Used Python because it’s easy, took me only 10-15 minutes and 7 lines of code.
Install phonenumbers library.
How my code works-
1. First it asks user to enter the number in string format.
2. Then parse it as US phone number.
3. Checks if number is valid or not. If it’s valid number, then format it in E164 phone number format. Else print not a valid number.