lundi 4 janvier 2021

My if statement is getting a syntax error pointing to the colon [closed]

so here is my code(BTW it's Reaaaaaaaaly simple)

number = int(input('Enter a number: ')
if number > 2:
  print(number, 'is greater than 2')
elif number < 2:
  print(number, 'is less than 2')

# print('Pls enter a proper number')

and this is the error I am getting

if number > 2:

^

SyntaxError: invalid syntax

and the arrow is pointing to the colon

And when I remove the colon I get a syntax error on the print statement and then I don't know what to do

BTW I am writing this code in google Colab

Aucun commentaire:

Enregistrer un commentaire