I want to add 5 to each element of a list by using a for loop. Why doesn't this work?
numbers = [1, 2, 3, 4, 5]
for n in numbers:
n = n + 5
print numbers
--
http://mail.python.org/mailman/listinfo/python-list
I want to add 5 to each element of a list by using a for loop. Why doesn't this work?
numbers = [1, 2, 3, 4, 5]
for n in numbers:
n = n + 5
print numbers
--
http://mail.python.org/mailman/listinfo/python-list