Question: In Python Write a function called madLib that takes in a string and a dictionary. The input dictionary will have keys that are integers and

 In Python Write a function called madLib that takes in a

In Python

Write a function called madLib that takes in a string and a dictionary. The input dictionary will have keys that are integers and data values that are strings Your function should replace the word in the original string at each key value with the data for that key value. Your function should return an updated string. Ex: inputString-I like chocolate milk" InputDictionary 10:"we", 3:"cookies" Should return the string "we like chocolate cookies" You may find the split() and str() functions for strings and lists to be useful

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!