Advertisement
fernando291092

Untitled

Mar 29th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. print("*********************************")
  2. print("Bem vindo ao jogo de Adivinhação!")
  3. print("*********************************")
  4. numero_secreto = 42
  5. total_de_tentativas = 3
  6. rodada = 1
  7.  
  8. while (rodada <= total_de_tentativas):
  9. print("Tentativa {} de {}".format(rodada, total_de_tentativas))
  10.  
  11. chute_str = input("Digite o seu número: ")
  12. print("Você digitou " , chute_str)
  13. chute = int(chute_str)
  14.  
  15. acertou = chute == numero_secreto
  16. maior = chute > numero_secreto
  17. menor = chute < numero_secreto
  18.  
  19. if(acertou):
  20. print("Parabéns! Você acertou!")
  21. else:
  22. if(maior):
  23. print("O seu chute foi maior do que o número secreto!")
  24. elif(menor):
  25. print("O seu chute foi menor do que o número secreto!")
  26.  
  27. rodada = rodada + 1
  28.  
  29. print("Fim do jogo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement