Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import *
- print('**************')
- print('Joguim de adivinha numeral')
- print('**************')
- tentativas = 5
- chute = 0
- numero = randrange(30)
- while tentativas > 0:
- chute = int(input('Digite um chute\n'))
- print('Você tentou:\n', chute)
- acerto = numero == chute
- maior = numero > chute
- menor = numero < chute
- if(acerto):
- print("parabéns, você acertou!", numero)
- else:
- tentativas = tentativas - 1
- if(maior):
- print("o número é maior\n")
- if(menor):
- print("o número é menor\n")
- print('restam:', tentativas)
- if tentativas == 0:
- print("Você perdeu")
- print("O número era:", numero)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement