• Does not need parentheses or curly braces for if else statements
  • We use indentation to determine what is in the if statement
  • Python uses elif for else if
n = 1
if n > 2:
	n -= 1
elif n == 2:
	n *= 2
else:
	n += 2

Logic operators

  • and == &&
  • or == ||
  • Parentheses needed for multi-line conditionals
n, m = 1, 2
 
if ((n > 2 and
	n != m) or n == m):
	n += 1