I ran this and it seems to add the numbers as a negative interger. Thoughts?
def sub(number):
total=0
for i in number:
total - = i
return total
I ran this and it seems to add the numbers as a negative interger. Thoughts?
def sub(number):
total=0
for i in number:
total - = i
return total
total -= i is the same as total = total - i
You start off by setting total to 0, and hence get negative integers sinceyou start subtracting from 0.
dbasher
ok ok, this makes some sense... now the question is should I even have a line setting the total. I'll try and play around with this a bit.. but
at least I have a direction. Thanks!
| Sysop: | Saxainden |
|---|---|
| Location: | Littleton, CO |
| Users: | 56 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 16:33:50 |
| Calls: | 1,676 |
| Calls today: | 1 |
| Files: | 44 |
| D/L today: |
3 files (2,530K bytes) |
| Messages: | 52,363 |