diff --git a/Python/015_ifconditional.py b/Python/015_ifconditional.py index f3663a0..6cafde5 100644 --- a/Python/015_ifconditional.py +++ b/Python/015_ifconditional.py @@ -15,4 +15,12 @@ print(f"Your name is: {name}") # Find method: https://www.w3schools.com/python/ref_string_find.asp if name.find(" ") == -1: print("You seem to have only entered a single name. Are you a rock star?") -print() \ No newline at end of file +print() + +# Many programming languages include a "ternary" operator/conditional +# This is used to return one value if a conditional evaluates to True +# or a different value if the conditional evaluates to False. +# This is especially useful when inside another function or statement. +# Usage: my_var = "Yes!" if a == b else "No!" +height = 73 +print("You are", " not" if height <= 71 else "", " tall!", sep='') \ No newline at end of file