Python/Project Euler/Problem 02/sol2.py
Parth Shandilya 07451a6ca4
Improved Code and removed warnings (#482)
Improved Code and removed warnings
2018-10-19 13:28:21 +05:30

13 lines
247 B
Python

def fib(n):
a, b, s = 0, 1, 0
while b < n:
if b % 2 == 0 and b < n: s += b
a, b = b, a+b
ls.append(s)
T = int(input().strip())
ls = []
for _ in range(T):
fib(int(input().strip()))
print(ls, sep = '\n')