By completing this challenge you will further improve your file manipulation techniques.
If you cannot remember how to open and read through a text file or CSV check our blog post about “how to access text files using Python”.
Your challenge consists of writing a program that will prompt the end-user to enter their telephone number.
Your program will extract the area code for this number and search for this area code using the CSV file given to you. The program will then display the location this phone number is linked to.
Complete the Code
Once your code is done, complete the following tests to check that your code is working as it should:
|Test #||Input Values||Expected Output||Pass/Fail?|
The CSV file also gives you the longitude and latitude coordinates of each area code. These coordinates can be used to calculate the distance between two sets of coordinates on the earth, using the Haversine formula. You could adapt your script to calculate the distance in miles between two UK phone numbers.
To find out more about the Haversine formula you may want to complete this challenge first: UK Postcodes distance calculator.