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

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


/* User Editable Region */

def main():
    card_number = '4111-1111-4555-1142'
    card_translation = str.maketrans({'-': '', ' ': ''})
    translated_card-number = return card_number(card_translation)
    

/* User Editable Region */

What’s the issue here

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0

Challenge Information:

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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hi @Waswabrian

You have a hypen instead of an underscore in the variable name.
Delete the return statement, as this in not needed.
Finally, you need to call the .translate method

Happy coding

1 Like

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.