"Syntaxerror: invalid syntax" error

Asked

Viewed 1,174 times

0

I was trying to run a very simple program through the terminal (use gnome Ubuntu):

#encoding: utf-8
y = int(input("Ultimo número: "))
x=0
while x <= y
   if x % 2 == 0
     print (x)
   x=x+1

and I came across the following mistake:

File "pares.py", line 4

    while x <= y
               ^
SyntaxError: invalid syntax

What is the cause of the problem in this case?

1 answer

4

Browser other questions tagged

You are not signed in. Login or sign up in order to post.