TypeError: "int object is not utterable"


#1

I’m having issues trying to fix a type error within my code:

def even_sum():
    print("how many integers? ", end="")
    number1 = int(input())
    for i in range(number1):
        print("next integer? ", end="")
        numbers = int(input())
    if numbers % 2 == 0:
        print("even sum= ", sum(numbers))
        print("even max= ", max(numbers))

the expected output is supposed to look like this:
how many integers? 4
next integer? 2
next integer? 9
next integer? 18
next integer? 4
even sum = 24
even max = 18

What am I doing wrong with the int object?


#2

sum() is a built-in function of an iterable (like a list), which you do not have.

What do you attempt to do?


#3

The TypeError occurs right after sum(numbers). I’m trying to sum all of the even numbers in the list created, as well as print the max even number in the list.


#4

you don’t have a list? you would need to make a list, append all the even numbers to list, then after the loop determine max and sum