6.2. Exercise: Send Bulk SMS Revisited ¶
Consider the same task from the previous question where you’re given the following version of ``get_phone_number``:
def get_phone_number(person):
customers = ["Jerry Seinfeld","George Constanza","Elaine Benes","Cosmo Kramer",
"Jim Halpert","Pam Beesly","Michael Scott","Dwight Schrute",
"Rachel Green", "Monica Geller", "Ross Geller", "Phoebe Buffay",
"Joey Tribbiani", "Chandler Bing"]
numbers = ["+1 960-454-6956", "+1 844-833-4965", "+1 543-920-5729", "+1 556-673-6702",
"+1 867-767-7664", "+1 410-570-7381", "+1 657-220-6601", "+1 940-573-6702",
"+1 813-856-3347", "+1 527-324-1403", "+1 687-801-6781", "+1 208-702-5161",
"+1 908-665-3975", "+1 444-970-5300"]
return numbers[customers.index(person)]
You can assume that the ``send_sms`` function is not changed and the same sample I/O can be used for testing.
What would be the type of exception for non-registered customers in this case and which line do you need to change in the previous code?