Coding question: Write a Translate function. Input: Set1: abc Set2: 123 Text: aaabbbcc Final output expected as Translated text: 11122233
Utilisateur anonyme
a = 'abc' b = '123' new_list = '' res = "aaabbbcc" for val in res: if val == 'a': new_list+='1' elif val == 'b': new_list+='2' else: new_list+='3' print (new_list)