Learning Objectives
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
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.

phonecodes.csv
Complete the Code
Video Tutorial
Test Plan
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? |
#1 | 01424000000 | Hastings | |
#2 | 01223999999 | Cambridge | |
#3 | 01736123456 | Penzance | |
#4 | 01401000000 | Not found! |
Extension
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.

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area