parm530
10/14/2019 - 12:26 PM

Conditionals

#
# Example file for working with conditional statements
#

def main():
  x, y = 100, 100
  
  # conditional flow uses if, elif, else  
  if(x < y):
    st = "x is less than y"
  elif(x == y):
    st = "x is equal to y"
  else:
    st = "x is greater than y"

  # python does not utilize switch/case statements

  # conditional statements let you use "a if C else b"
  st = "x is less than y" if (x < y) else "x is greater than or the same as y"
  
  print(st)

if __name__ == "__main__":
  main()