How can I write a definition for a function that is passed a list of numbers and returns the sum of the numbers in that list using a while loop?
I'm trying this, but it's not working
def sumList():
num = [1,2,3]
sum = 0
while num != str:
for i in num:
sum += i
print(sum)
Is there a way to not even use for?