Fibonacci show every 2nd number

I literally just started with coding and all that so i’m not sure how to correct or recognize my mistake. When I run this it always says invalid syntax. I was trying to make the code run the fibonacci numbers but only that it shows every second number

a=0
b=1
Liste=[]

n=int(input("hm?"))+1

for x in range(1,n)
a=b
b=c
c=a+b
liste.append(c)

print(liste)
print(liste[::2]

What is the specific syntax error that it gives you? It is probably telling you the exact line and column numbers where the error is. The code you shared here will not work in Python because it is missing whitespace.

it only says “invalid syntax” and then a red line next to the “for x in range(1,n)” appears. So I just have to put there a whitespace?

Ok I tried adding but no difference

Edit: I forgot the " : " after for x in range(1,n) lol then I had to put some space and now it says “unexpected eof while parsing” hopefully google can help me with that

ohh my code works now

a=0
b=1
liste=[]

n=int(input("hmm?"))+1

for x in range(1,n):
    c=a+b
    liste.append(c)
    a=b
    b=c
print(liste)
print(liste[::2])

Thanks for your input!

Congratulations on figuring it out! Happy coding.

1 Like