Skip to content

Instantly share code, notes, and snippets.

@go4Mor4
Created August 31, 2018 21:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save go4Mor4/ef7bf56901b1e1d8108a34c5081fc590 to your computer and use it in GitHub Desktop.
Save go4Mor4/ef7bf56901b1e1d8108a34c5081fc590 to your computer and use it in GitHub Desktop.
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