“Python Turnary” Respostas de código

operador ternário em python

a, b = 10, 20
# Copy value of a in min if a < b else copy b 
min = a if a < b else b 
Delightful Dunlin

Python Turnary

(if_test_is_false, if_test_is_true)[test]
Ugly Unicorn

Python Turnary

is_nice = True
state = "nice" if is_nice else "not nice"
Ugly Unicorn

Respostas semelhantes a “Python Turnary”

Perguntas semelhantes a “Python Turnary”

Procure respostas de código populares por idioma

Procurar outros idiomas de código