Created
November 28, 2014 02:16
-
-
Save maluta/c0998a4872a591af2d2b 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
import random | |
perguntas = [ | |
"Forneça ............. ?", | |
"Organize ............. ?", | |
"Aonde ............. ?", | |
"Escolha ............. ?", | |
"Quais ............. ?", | |
"Como ............. ?", | |
"Quantos ............. ?", | |
"Qual ............. ?", | |
"O que ............. ?", | |
"Quando ............. ?", | |
] | |
respostas = [ | |
#("a primeira resposta de cada pergunta é a certa") | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
["CERTO","ERRADO","ERRADO"], | |
] | |
#------------ | |
def main(): | |
for índice,pergunta in enumerate(perguntas): | |
print(str(índice+1) + ": " + pergunta) | |
# shuffle embaralha só pra mostrar na tela | |
respostas_embaralhas = list(respostas [índice]) | |
random.shuffle(respostas_embaralhas) | |
x = [] | |
for opção,r in zip(["a","b","c"],respostas_embaralhas): | |
x.append(opção + ") " + r) | |
print(opção + ") " + r) | |
# entrada do usuário | |
resposta = input("Qual a resposta? ") # resposta vai ser uma letra | |
for r in x: | |
if r.startswith(resposta) == True: | |
if r.find(respostas[índice][0]) != -1: | |
print("+---------------+") | |
print("| Parabéns |") | |
print("| Você acertou |") | |
print("+---------------+") | |
break | |
else: | |
print("+-----------------+") | |
print("| Você errou |") | |
print("+-----------------+") | |
main() | |
# ^^^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment