Question: Use python and the rest countries API: Function name: translator Parameters: codeList (list of strings) Returns: dictionary where key and value are both strings Description:
Function name: translator Parameters: codeList (list of strings) Returns: dictionary where key and value are both strings Description: Travelling around the world involves learning new languages! Write a function that takes in a list of 3-letter codes representing a country and return a dictionary where the key is the name of the country and the value is the name of the country in its own language. Note that this function must be able to ignore three letter codes that do not correspond to a country without erroring. You can assume that we will not test strings that contain numbers. Hint: The API will output something different if the country code is not valid. Try using pprint with a request that uses an incorrect three-letter code and see what it outputs! Test Cases: >>> print (translator([])) 0 >> print(translator(["3PN", "ita", "aaa"])) ('Japan' Bx''Italy: Italia')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
