Some observations:
- sum() is Python built-in function. Never use it as name.
- I personally prefer take user input in following way (subjectively it's more readable):
- otherwise your code a quite a mess; you set sum to zero then create function with same name. You use name sum inside of function sum; function is defined but never used etc.
Function should be quite simple: you have list, you define total with value zero, you iterate over list elements and add all elements to total, you return total.
- sum() is Python built-in function. Never use it as name.
- I personally prefer take user input in following way (subjectively it's more readable):
x = int(input("Enter how many numbers: ))
- otherwise your code a quite a mess; you set sum to zero then create function with same name. You use name sum inside of function sum; function is defined but never used etc.
Function should be quite simple: you have list, you define total with value zero, you iterate over list elements and add all elements to total, you return total.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.