1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-01-17 21:49:22 +01:00

Merge pull request #3989 from kevinnls/improve-python_en

[python/en] improved demo of `if` expression
This commit is contained in:
Max Schumacher 2020-08-05 15:33:20 +02:00 committed by GitHub
commit 7ff98eff4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,7 +186,7 @@ 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!"
"yay!" if 0 > 1 else "nay!" # => "nay!"
# Lists store sequences
li = []