Question: Implement function q4(stringToProcess, translationDict) that takes two arguments: - stringToProcess: a string of alternating single digit numbers and alphabetic characters . For example: 1a4z, 3b0x9c

Implement function q4(stringToProcess, translationDict) that takes two arguments: - stringToProcess: a string of alternating single digit numbers and alphabetic characters . For example: "1a4z", "3b0x9c" - translationDict: a dictionary with characters for keys and strings for values q4 should return a string constructed as follows. For each digit-character pair, i and c, in stringToProcess, if c is in translationDict, the result string should contain i instances of the string value associated with key c in the dictionary. If c is not in translationDict, use i instances of '-'

For example: q4("1a2b", {'a': '!!!', 'b': '*'}) should return '!!!**' q4("1a1b1a0b1a2z", {'a': '!!!', 'b': '*'}) should return '!!!*!!!!!!--'

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!