Learning python for two days :) and now I attempting to solve Project Euler problem #2 and I need help.
To be more specific, I need know know how to add numbers that were added to a empty list. I tried 'sum' but doesn't seems to work how the tutorial sites suggest. I'm using python 3. Here's my code so far:
a = 0
b = 1
n = a+b
while (n < 20):
a, b = b, a + b
n = a+b
if n%2 == 0:
mylist = []
mylist.append(n)
print(sum(mylist))
this outputs:
2
8
Now how do I add them? Thanks :)