Learn How to Work with Numbers and Strings by Implementing the Luhn Algorithm - Step 4

Tell us what’s happening:

I am unable to put the variable in the code can someonne help me in this scenario.

Your code so far


# User Editable Region

def main():
    card_number = '4111-1111-4555-1142'
    card_translation = str.maketrans({'-': '', ' ': ''})
    translated_card_number = translated_card_number.translate(translateion_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/135.0.0.0 Safari/537.36

Challenge Information:

Learn How to Work with Numbers and Strings by Implementing the Luhn Algorithm - Step 4

Hi @punitdave000

You have a message in the console.

image

Happy coding

How can i solve this? my code is not passing and it is saying to write translated_card_number in the code under main please help me

Create a variable called translated_card_number and assign it the result of calling the translate method on card_number with card_translation as an argument.

Your code is calling the translate method on translated_card_number not card_number.

The traceback is indicating a syntax error on line 6.

Happy coding

unable to understand this

can you explain more clearly what you don’t understand? it is difficult to know what to explain otherwise

the way you are saying to call the translate on the translated_card_number that is only where i am getting stuck i am unable to understand where can i put this step.

you are using it here, you need to replace translate_card_number with something that exists here