Question: 22a. decipher.py Write a function decipher(codex, secret_message) that uses the dictionary codex to decode secret message . For example: codex = { s : i
22a. decipher.py
Write a function decipher(codex, secret_message) that uses the dictionary codex to decode secret message.
For example:
codex = {"s": "i", "y": "a", "e": "m", "q": "g", "p": "r", "n": "o", "t": "t"} decipher(codex, "S ye Qpnnt!") Would return:
I am Groot! b. auto_correct.py
Write a function auto_correct(correct_words,text) where correct_words is a dictionary that maps commonly misplelled words to their correct spelling. Use correct words to autocorrect any applicable mispellings in text.
correct_words= {"Teh": "The", "mispelled": "misspelled", "corects": "corrects"} auto_correct(correct_words, "Teh function corects mispelled words!") Would return:
The function corrects misspelled words! c. shopping_cart_total.py
Write a function shopping_cart_total(cart, prices) where cart is a dictionary that maps shopping items to the quantity bought (eg. forks: 4) and prices is a dictionary that maps store items to how much they cost (eg. milk: 2.99). Use cart and prices to compute the total cost of all items in the cart.
For example:
cart = {"apple": 3, "soup": 5, "ramen": 3, "milk": 1} prices = {"apple": 1, "soup": 3, "ramen": 1, "milk": 2} shopping_cart_total(cart, prices) Would return:
23 Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
