[Python] Why am I getting TypeError: 'int' object is not iterable in my Python function?...

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to write a Python function that calculates the sum of squares of numbers in a list. However, when I run my code, I get the following error:

    def sum_of_squares(numbers):
    total = 0
    For num in numbers:
    total += num ** 2
    return total


    print(sum_of_squares(5))

    Continue reading...

Compartilhe esta Página