[Python] I need to debug my syntax to find errors. Im still trying to grasp the concept of...

Discussão em 'Python' iniciado por Stack, Fevereiro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am new to debugging and would need help with identifying the errors found in the syntax below;

    ans1 = []

    ans2 = None

    def counter(L):

    b=[]

    summ = 0

    prev_element = 0

    for element in L:

    summ = prev_element + element

    prev_element = element

    b.append[element]

    return b, summ

    a=[0,2,4]

    ans1, ans2 = counter(a)

    print(ans1, ans2)

    • I have changed the append from square brackets to parenthesis

    Continue reading...

Compartilhe esta Página