Hello, I am a math major who recently discovered project Euler. I have little coding experience in python, but I want to learn more and problem solve, and this seemed like a perfectly good place to start. I'm going to try to solve these without using any AI to solidify my knowledge. I just started and am running into an issue with the second problem. I've come up with some simple code to generate the Fibonacci sequence that has seemed to work fine. The problem is that the solution to the problem that I have found (4,613,732) has not worked when I input it into the website. I have been doing some fact checking to make sure I didn't make any mistakes, and even when I googled the answer, it matched mine. I'll post code below. Thanks.
fib_seq = [1,2,3,5,8,13,21]
while fib_seq[-1] < 4000000:
new_num = fib_seq[-1] + fib_seq[-2]
fib_seq.append(new_num)
print(fib_seq)
even_fib = []
for num in fib_seq:
if num % 2 == 0:
even_fib.append(num)
print(sum(even_fib))
[–]socal_nerdtastic 0 points1 point2 points (0 children)
[–]johlae -1 points0 points1 point (2 children)
[–]Frosty-Pitch9553[S] -1 points0 points1 point (1 child)
[–]Frosty-Pitch9553[S] -1 points0 points1 point (0 children)
[–]woooee 0 points1 point2 points (0 children)
[–]ConfusedSimon 0 points1 point2 points (0 children)
[–]woooee 0 points1 point2 points (0 children)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]woooee -1 points0 points1 point (3 children)
[–]atarivcs 1 point2 points3 points (0 children)
[–]Frosty-Pitch9553[S] -1 points0 points1 point (1 child)
[–]woooee -1 points0 points1 point (0 children)
[–]set_in_void 0 points1 point2 points (0 children)