subject

The three functions below all concern a functional way to store a dictionary. We store a dictionary as a tuple of 2-tuples: index 0 of each 2-tuple is a key; index 1 is that key's associated value. The order of the keys is irrelevant, but keys are unique: no 2-tuples can have the same keys. For example the dictionary {'a': 1, 'b': 2, 'c': 3} might be stored as (('b',2), ('a',1), ('c', 3)) -or any other tuple with these 2-tuples in any order. We call such a data structure an association tuple. • Define a recursive function named get_assoc; it is passed an association tuple and key as arguments; it returns the value in the association tuple associated with the key. If the key is not in the association tuple, raise the KeyError exception. • Define a recursive function named del_assoc; it is passed an association tuple and key as arguments; it returns an association tuple that contains all associations except the one specified by the key parameter (keep the order of the other keys in the association tuple the same). If the key is not in the association tuple, raise the ReyError exception. Hint: build a new association tuple with all associations but the deleted one. • Define a recursive function named set_assoc; it is passed an association tuple, key, and associated value as arguments; it returns an association tuple that contains all associations with (a) a new 2-tuple added at the end for this association (if the key is nowhere in the association tuple) or (b) one of the associations changed (if the key is already in the tuple). Keep the key order the same. For example,

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 23:30
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
George is working as a programming team lead. which statements correctly describe the skills that he requires?
Answers: 3
question
Computers and Technology, 25.06.2019 02:00
Feedback is one of the basic elements games have in common true false
Answers: 2
question
Computers and Technology, 25.06.2019 05:30
The piston ring isn't a completely solid ring; instead, it's usually split at one point. this split or gap in the ring is called the a. ring spacing. b. ring clearance. c. ring end gap. d. ring side clearance.
Answers: 2
You know the right answer?
The three functions below all concern a functional way to store a dictionary. We store a dictionary...
Questions
question
Mathematics, 05.02.2021 05:00
question
Engineering, 05.02.2021 05:00
question
Mathematics, 05.02.2021 05:00
Questions on the website: 13722359