User Tools

Site Tools


clubs:python_club:python_club_conditional_statements
Home | clubs :: cloud club :: python_club :: 3D-Printing | projects :: Proxmox | Kubernetes | scripting | utilities | games

About the Club

Python Club Topics - Conditional statements

Conditional statements

  1. Determine 1 of multiple paths or which set of code to run depending on the evaluation of a condition
  2. if
  3. if/else
  4. if/elif/else

if example

  1. a = 100
    b = 200
     
    if b > a:
      print("b is greater than a")

if/else example

  1. a = 300
    b = 200
     
    if b > a:
      print("b is greater than a")
    else:
      print("a is greater than b")

if/elif/else example

  1. a = 200
    b = 200
     
    if b > a:
      print("b is greater than a")
    elif a == b:
      print("a and b are both equal")
    else:
      print("a is greater than b")
clubs/python_club/python_club_conditional_statements.txt · Last modified: by 127.0.0.1