Skip to content

Instantly share code, notes, and snippets.

@NadiaaOliverr
Last active July 31, 2023 20:34
Show Gist options
  • Select an option

  • Save NadiaaOliverr/8ee08b9090b675435dc4c2250ccb868c to your computer and use it in GitHub Desktop.

Select an option

Save NadiaaOliverr/8ee08b9090b675435dc4c2250ccb868c to your computer and use it in GitHub Desktop.
operador_ternario.py
preco_pizza_frango = 25.00
preco_pizza_lombo = 30.00
# Condição usando o operador ternário
escolha = "frango" if preco_pizza_frango <= preco_pizza_lombo else "lombo"
print(f"Vou escolher a pizza de {escolha}!") # Saída: Vou escolher a pizza de frango!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment