Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ternary_operator.py
- a = 5; b = 4
- answer = "a is greater than b" if a > b else "a is less than b"
- print(answer) # a is greater than b
- b = 12
- answer = "a is greater than b" if a > b else "a is less than b"
- print(answer) # b is greater than a
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement