Answers for "inline_ternary(if)_condition"

0

inline_ternary(if)_condition

#inline ternary condition
x = 1 if 2 > 3 else 0
print(x)						# 0
# classic writing will be
if 2 > 3 :
	x = 1
else :
	x = 0
print(x)

# in javascript
# x = 2 > 3 ? 1 : 0					# 0
Posted by: Guest on March-21-2022

Python Answers by Framework

Browse Popular Code Answers by Language