Created
August 31, 2018 21:12
-
-
Save go4Mor4/ef7bf56901b1e1d8108a34c5081fc590 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 | |
import time | |
import os | |
teclado = [ | |
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', | |
'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', | |
'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', | |
'9', '0' | |
] | |
lista = [] | |
def init(): | |
caractere_aleatorio = random.choice(teclado) | |
lista.append(caractere_aleatorio) | |
palavra = "".join(lista) | |
print(palavra) | |
time.sleep(1) | |
os.system('cls' if os.name == 'nt' else 'clear') | |
resposta_usuario = input("o que você viu? : ") | |
resultados = [] | |
for caractere in resposta_usuario: | |
if caractere in lista: | |
resultados.append(True) | |
else: | |
resultados.append(False) | |
if all(resultados): | |
print("voce ganhou") | |
init() | |
else: | |
lista.clear() | |
print("voce perdeu") | |
print("Reiniciando em 3 segundos...") | |
time.sleep(3) | |
init() | |
init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment