concept area code in category python

appears as: area code, rea codes, area codes
Get Programming: Learn to code with Python

This is an excerpt from Manning's book Get Programming: Learn to code with Python.

Write a program that reads input from a file in a specific format, regarding all your friends’ names and phone numbers. Your program should store that information and analyze it in some way. For example, you can show the user where their friends live based on the area code of the phone numbers, and the number of states where they live.

The function iterates through every number in phones and looks only at the first three digits (the area code). It keeps track of all the area codes it has seen so far and adds it to the unique area codes tuple only if it isn’t already in there.