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

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


/* User Editable Region */

def verify_card_number(card_number):
    card_number_reversed = card_number[::-1]
    odd_digits = card_number_reversed[::2]
    even_digits = card_number_reversed[1::2]
    
    sum_of_odd_digits = 0
    for digit in odd_digits:
        sum_of_odd_digits += int(digit)
        print(digit)
    
    sum_of_even_digits = 0
    for digit in even_digits:
        sum_of_even_digits += int(digit)
        print(digit)
    
    print(sum_of_odd_digits)
    print(sum_of_even_digits)
    
    # Return the odd digits or perform additional processing
    return odd_digits




/* 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 24

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.

first click on reset button and reset the code. As per the instruction

Loop over the even digits and print each to the console.

use for loop and inside for loop print the value.

> Syntax for loop

for value in listvariable:
    statement1
    statement2
    .
    .
    statementn

here’s an external link for u to understand about for loop concept
https://www.w3schools.com/python/python_for_loops.asp

Loop over the even digits and print each to the console.

It looks like you copy/pasted what you did with with odd_digits, which is a good idea.

However the instructions don’t ask for all of those lines. Just loop and print, that’s all.

You also moved a line? Reset the lesson as @aaronvincent6411 suggests :+1:

Also, please describe your problem and any questions you have. If there is something that you need to know, we can’t know what that is

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