Created
March 16, 2017 09:49
-
-
Save Mdslino/806579d7d7de06942d146f2add99e215 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Primeira forma de fazer, simples para aprendizado | |
x = input("Digite a letra: ") | |
if x.lower() == "m": | |
sexo = "Masculino" | |
print(sexo) | |
elif x.lower() == "f": | |
sexo = "Feminino" | |
print(sexo) | |
else: | |
print("Sexo Inválido") | |
#Segunda forma, fazendo a atribuição condicional diretamente em sexo: | |
x = input("Digite a letra: ") | |
sexo = "Masculino" if x.lower() == "m" else "Feminino" if x.lower() == "f" else "Sexo Invalido" | |
print(sexo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment