I just want to print the length and sum of array values, that I input into the list.
Here is my code:
arr = list()
for x in range(1,6):
print("Enter num ", x ," :")
name = input()
arr.append(name)
print ("ARRAY: ",arr)
l = len(arr)
s = sum(arr)
print (int(l,s))
And the output is:
ARRAY: ['4', '2', '3', '4', '6']
Traceback (most recent call last):
File "main.py", line 8, in <module>
s = sum(arr)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Try this instead: