Apr-02-2019, 02:07 PM
hello,
i get an error in this program when trying to find the sum of the values in the array.
this is the error "Line 7: TypeError: 'int' object is not callable"
the code should be adding random integers to the array and then find the sum. but it gives me that error.
i get an error in this program when trying to find the sum of the values in the array.
this is the error "Line 7: TypeError: 'int' object is not callable"
the code should be adding random integers to the array and then find the sum. but it gives me that error.
def test(): import random sum = 0 num = int(input("How many values to add to the array: ")) for x in range (num): array.append(random.randint(10,99)) sum = sum(array) print (sum) return (array) ##############MAIN############## array = [] test()