You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
challenges/2/main.py

21 lines
240 B

2 years ago
fibs = [1]
a = 1
b = 1
while a <= 4_000_000 or b <= 4_000_000:
num = a + b
fibs.append(num)
a = b
b = num
print(fibs)
even_fibs = []
for i in fibs:
if i % 2 == 0:
even_fibs.append(i)
print(sum(even_fibs))