Created
July 29, 2023 15:45
-
-
Save paulodutra/ce0133cfa8af91712af33f542ae55dcc to your computer and use it in GitHub Desktop.
An example using python for hit random number.
This file contains hidden or 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 | |
tentativas = 0 | |
palpite = False | |
numSorteado = random.randint(1,10) | |
while (palpite is False): | |
num = int(input('Digite um numero: ')) | |
if num != numSorteado: | |
tentativas = tentativas + 1 | |
else: | |
tentativas = tentativas + 1 | |
palpite = True | |
print('Você acertou o numero na {} tentativas, o número sorteado foi {}'.format(tentativas, numSorteado)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment