0

# Why do I get a syntax error?

I am trying to make a program that asks you how many digits of the Fibonacci sequence you want to see and then output that many digits so if I say "10" it outputs 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 but I get a syntax error on the line "while (spam < eggs)" My code is the following: a = 0 b = 1 c = 0 spam = 2 eggs = int(input("How many digits of the Fibonacci sequence do you want to see? --> ")) eggs = eggs + 2 print(a) print(b) while (spam < eggs) c = a + b a = b b = c print(c) spam = spam + 1

2 Answers

+ 16

it should be
while spam<eggs:

0

You are missing a colon at the end, plus parenthesis are not required in this example. So it should be:
while spam < eggs:
...