TypeError: the 'int' object is not callable error 1

TypeError: the ‘int’ object is not callable error

TypeError: the 'int' object is not callable error

item_price = [10, 33, 55, 77]
sum = 0
sum = sum(item_price)
print("The sum of all the items is:", str(sum))

Here is what the above code is Doing:
1. We create a list of item prices.
2. We create a variable called sum and set it to 0.
3. We then try to set the sum variable to the sum of the item_price list.
4. We then print the sum.

The problem is that we’re trying to call the sum variable as a function.

The solution is to change the name of the sum variable to something else.

Similar Posts