mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Merge pull request #1643 from ankitaggarwal011/python3-ternary-operator-documentation-add
[python3/en] Adding documentation on ternary operator
This commit is contained in:
commit
582a205219
@ -174,6 +174,10 @@ some_var # => 5
|
||||
# See Control Flow to learn more about exception handling.
|
||||
some_unknown_var # Raises a NameError
|
||||
|
||||
# if can be used as an expression
|
||||
# Equivalent of C's '?:' ternary operator
|
||||
"yahoo!" if 3 > 2 else 2 # => "yahoo!"
|
||||
|
||||
# Lists store sequences
|
||||
li = []
|
||||
# You can start with a prefilled list
|
||||
|
Loading…
Reference in New Issue
Block a user