[Solved]Dictionary Problems 4 Consider Following Variable Test Portugal Lisbon Leonor 1700 097 Nun Q37207657


Dictionary Problems 4) Consider the following variable test-{ Portugal’: { Lisbon : Г(Leonor. ‘1700-097’), (‘Nuno”. ‘1050-100)! . Porto’: (‘Ana’, ‘4150 036)]). ‘Uniied Stales’: { Miaini: [(Naicy’. ‘33136’). (Fred’. ‘34136)]. Cliicago’: [(Cesar. 60661)] United Kingdom: Tondon: [Sarr, ‘SWIH OB D)]> What are the values of the following dictionary access. Specity if an error occurs (a) test[‘Portugal’][Porto’] (b) testl’Portugal’1TPorto’TT01r01 (c) restl’United Stares’][‘Miami ‘][1] (d) test’UUnited States’][‘Miami ‘][1][0][0] (e) test[‘United States’][‘Miami’][1][1][1] 5) Define a function named findKeyPairs(iyDictl, myDict2). It works like this (I) if myDict/ and myDict2 arc cmpty, rctun an cmpty list (2) check all the possible keys combinations (from myDicil to myDict2), and combine the pairs values, if the new valuc is palindromc (c.g., “aba’), then save this key pair (a list whosc first element is the key from myDict, and second element is the key from myDict2) to a new list (3) rctum the new list who has the desired kcy pairs Note: Assume the valucs arc string. If one of the passcd in dictionaricrs is cmpty, c.g myDici2 is cmpty, then you still are required to consider myDictl and check all of its values. For example, if the value of any key, e.은·”abba”, from myDicti is palindrome, then that key pair should be [“abba”,-‘) [[“ab”, “ba”].[ab”, “a”], [“cd”, “edc”]] Use the signature def findKeyPairs(myDictl, myDict2): 6) Define a function called matchValues. This function will take in two dictionaries and return a list of keys where the key’s values are equal. The new list will not have duplicates and can be in any order. We are looking at values for matching and not the keys themselves >>>>matchValues( 1: “а”, 2: “b.,, “ада”, 3}, {3: “a”, 4: “C”, 5: 3, 6: “a”)) Use the signature: def matchValues (myDictl, myDict2): Show transcribed image text Dictionary Problems 4) Consider the following variable test-{ Portugal’: { Lisbon : Г(Leonor. ‘1700-097’), (‘Nuno”. ‘1050-100)! . Porto’: (‘Ana’, ‘4150 036)]). ‘Uniied Stales’: { Miaini: [(Naicy’. ‘33136’). (Fred’. ‘34136)]. Cliicago’: [(Cesar. 60661)] United Kingdom: Tondon: [Sarr, ‘SWIH OB D)]> What are the values of the following dictionary access. Specity if an error occurs (a) test[‘Portugal’][Porto’] (b) testl’Portugal’1TPorto’TT01r01 (c) restl’United Stares’][‘Miami ‘][1] (d) test’UUnited States’][‘Miami ‘][1][0][0] (e) test[‘United States’][‘Miami’][1][1][1] 5) Define a function named findKeyPairs(iyDictl, myDict2). It works like this (I) if myDict/ and myDict2 arc cmpty, rctun an cmpty list (2) check all the possible keys combinations (from myDicil to myDict2), and combine the pairs values, if the new valuc is palindromc (c.g., “aba’), then save this key pair (a list whosc first element is the key from myDict, and second element is the key from myDict2) to a new list (3) rctum the new list who has the desired kcy pairs Note: Assume the valucs arc string. If one of the passcd in dictionaricrs is cmpty, c.g myDici2 is cmpty, then you still are required to consider myDictl and check all of its values. For example, if the value of any key, e.은·”abba”, from myDicti is palindrome, then that key pair should be [“abba”,-‘) [[“ab”, “ba”].[ab”, “a”], [“cd”, “edc”]] Use the signature def findKeyPairs(myDictl, myDict2):
6) Define a function called matchValues. This function will take in two dictionaries and return a list of keys where the key’s values are equal. The new list will not have duplicates and can be in any order. We are looking at values for matching and not the keys themselves >>>>matchValues( 1: “а”, 2: “b.,, “ада”, 3}, {3: “a”, 4: “C”, 5: 3, 6: “a”)) Use the signature: def matchValues (myDictl, myDict2):
Expert Answer
Answer to Dictionary Problems 4) Consider the following variable test-{ Portugal’: { Lisbon : Г(Leonor. ‘1700-097’), (‘Nuno”. ’10… . . .
OR

