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
Get step-by-step solutions from verified subject matter experts
