migrate to git.charlotte.sh
This commit is contained in:
commit
fbd588721e
412 changed files with 13750 additions and 0 deletions
13
python-csi160/week05/week-5Practice-Problems/part4.py
Normal file
13
python-csi160/week05/week-5Practice-Problems/part4.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
def area_code(phone_number):
|
||||
""" Given a phone number in the format: 802-555-1212
|
||||
extract the first 3 characters and return this as a string
|
||||
|
||||
:param phone_number: (str) Must be formatted "XXX-XXX-XXXX"
|
||||
:return: (str) 3 digit area_code
|
||||
"""
|
||||
return phone_number[:3]
|
||||
|
||||
|
||||
# Leave this part for easily testing your function
|
||||
print('"802-555-1212" area_code returns', area_code("802-555-1212"))
|
||||
print('"410-617-3452" area_code returns', area_code("410-617-3452"))
|
Loading…
Add table
Add a link
Reference in a new issue