Question: python language please, practice with regular expressions and string processing Part II: Determine a Package's Destination (10 points) Write a function package destination ), which
python language please, practice with regular expressions and string processing



Part II: Determine a Package's Destination (10 points) Write a function package destination ), which takes two arguments in the following order: 1. package.code: a string that might represent a valid shipping code on a package 2. country.codes: a dictionary that matches a country's code (a string) to the name of a country A validly formatted address is defined by the following components, in the given order: 1. three digits CSE 101 -Spring 2018 Lab #13 Page 3 2. a dash 3. three digits 4. a dash 5. one uppercase letter 6. one digit If the string is validly formatted, the function extracts the three-digit country code at the start of the string and uses it as a key in the country-codes dictionary. The country name associated with the key is returned by the function. If the package.code is invalidly formatted, or it is validly formatted but the extracted country code is not in the dictionary, the function returns the string error Hint: after verifying that the argument string matches the expected pattern, use the split ) method to extract the part of the string needed for the dictionary lookup
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
