Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Created July 29, 2023 15:45
Show Gist options
  • Save paulodutra/ce0133cfa8af91712af33f542ae55dcc to your computer and use it in GitHub Desktop.
Save paulodutra/ce0133cfa8af91712af33f542ae55dcc to your computer and use it in GitHub Desktop.
An example using python for hit random number.
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