Skip to content

Commit 8c1563b

Browse files
committed
Contributing to your code explaining if ternary in python
1 parent 9a10a38 commit 8c1563b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Python in 90 minutes/Python in 90 minutes.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@
157157
if grade == 'A':
158158
print('I can go to the party!')
159159

160+
# if ternary
161+
x = 10
162+
y = 20
163+
# action/ if condition true/ else condfition false
164+
z = x + y if x > y else y - x
165+
print(z)
166+
# result 10
167+
168+
160169
# STRINGS
161170
# ------------------------------------------------
162171
# a string is a sequence of characters (ie. text)

0 commit comments

Comments
 (0)