The function below takes a single string parameter: phone_number. Phone numbers will be passed in using the format '(555)867-5309'. Complete the function to return the area code (the numbers wrapped in parentheses) as a string. For example, your code should return '555' if given the phone number above. Hint: you can just use slicing for this.

Respuesta :

Answer:

def get_area_code(phone_number):

   return phone_number[1:4]

# Testing function

print(get_area_code('(555)867-5309'))

print(get_area_code('(254)867-5309'))

print(get_area_code('(181)867-5309'))

ACCESS MORE