FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
programmingWithPythonCode/syntax/if_else_inline.py at main · thomasWeise/programmingWithPythonCode · GitHub
thomasWeise
programmingWithPythonCode
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
programmingWithPythonCode
/
syntax
/
if_else_inline.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
14 lines (12 loc) · 791 Bytes
Breadcrumbs
programmingWithPythonCode
/
syntax
/
if_else_inline.py
Copy path
File metadata and controls
14 lines (12 loc) · 791 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""The syntax of a inline "if-else"-statements in Python."""
# If conditionForUsingValueA evaluates to True, then valueA will be
# assigned to variable. Otherwise, valueB will be assigned to variable.
variable
=
valueA
if
conditionForUsingValueA
else
valueB
# If conditionForUsingValueA evaluates to True, then valueA will be
# assigned to variable. Otherwise, conditionForUsingValueB is evaluated.
# If conditionForUsingValueB did evaluate to True, then valueB is
# assigned to variable (but of course, only if conditionForUsingValueA
# was False). If conditionForUsingValueB did evaluate to False (and
# conditionForUsingValueA was also False), then valueC will be assigned
# to variable.
variable
=
valueA
if
conditionForUsingValueA
else
(
valueB
if
conditionForUsingValueB
else
valueC
)
Back
|
FazBrowse Home
|
New Git URL