Project Euler #2: Even Fibonacci numbers

  • + 0 comments

    Python 3 solution. Thoughts?

    import sys
    
    t = int(input().strip())
    
    for a0 in range(t):
        n = int(input().strip())
        
        a, b, s = 1, 2, 0
        
        while b <= n:
            if b % 2 == 0:
                s += b
                
            a, b = b, a + b
            
        print(s)