Python if else

  • if statement
  • if..else statements
  • nested if statements
  • if elif ladder
  • Short Hand if statements
  • Short Hand if else statements
if (condition):
# Executes this block if
# condition is true
else:
# Executes this block if
# condition is false
python if else condition
i is greater than 15
i'm in else Block
i'm not in if and not in else Block

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store