if statement in python 3.

step to use if statement:

x = int(input("Enter your integer number: "))

if x < 0:
    print ("It is negative")

else:
    print ("It is non-negative")

SAVE AND RUN.

REMEMBER: If and Else should be at the same "indentation level".

it will give error if you write:

if blah blah
  else blah blah

0 comments:

Post a Comment