what is Python condition (if)

what is Python condition (if)

·

1 min read

condition statement in Python

if Statement

  • Keyword: if, elif, else
  • if must there before use elif, else

if [condition] : [space]code you want to run elif [condition] : [space]code you want to run else : [space]code you want to run

if Statement Example

a = 3
if a > 5:
    print("a is bigger than 5")
elif a > 0:
    print("a is bigger than 0 but smaller than 5")
else:
    print("a is negative")