3
answers
0
watching
276
views
23 Oct 2018

Question 5. [7 MARKS] Part (a) (6 MARKS) Write the body of the following function according to its docstring description. def numeric-phone (alphanumeric_phone, mapping): (str, list of str) -> int Preconditions: - len(mapping) <= 10 - alphanumeric-phone contains only digits and uppercase letters - each letter in alphanumeric_phone is guaranteed to appear in mapping once - mapping may contain letters not in alphanumeric-phone Return a numeric phone number that corresponds to alphanumeric_phone. Each letter from alphanumeric-phone is replaced with the index of the item from mapping that contains the letter. Digits are not replaced. >>> numeric-phone ('416310BELL', ['ABC', 'DEF', 'GHI', 'JKL', 'NO', 'PQRS', 'TUV', 'WXYZ']) 4163100133

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Nestor Rutherford
Nestor RutherfordLv2
25 Oct 2018
Already have an account? Log in
Start filling in the gaps now
Log in