translated_card_number = “4112-2112-2113”
translation_table = translated_card_number.maketrans({‘4’: ‘1’, ‘1’: ‘2’, ‘-’: ‘’, ‘2’: ‘1’, ‘3’: ‘’})
translated_card_number = translated_card_number.translate(translation_table)
print(translated_card_number)
Your code so far
/* User Editable Region */
translated_card_number = "4112-2112-2113"
translation_table = translated_card_number.maketrans({'4': '1', '1': '2', '-': '', '2': '1', '3': ''})
translated_card_number = translated_card_number.translate(translation_table)
print(translated_card_number)
/* User Editable Region */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Challenge Information:
Learn How to Work with Numbers and Strings by Implementing the Luhn Algorithm - Step 4