Advertisement
here2share

# ternary_operator.py

Apr 5th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. # ternary_operator.py
  2.  
  3. a = 5; b = 4
  4. answer = "a is greater than b" if a > b else "a is less than b"
  5. print(answer) # a is greater than b
  6.  
  7. b = 12
  8. answer = "a is greater than b" if a > b else "a is less than b"
  9. print(answer) # b is greater than a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement