Skip to content

Commit 5acf157

Browse files
authored
Código 2
1 parent ccd96dd commit 5acf157

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Jogo de adivinhação

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import random
2+
3+
def jogo_adivinhacao():
4+
numero_secreto = random.randint(1, 100)
5+
tentativas = 0
6+
while True:
7+
palpite = int(input("Adivinhe o número entre 1 e 100: "))
8+
tentativas += 1
9+
if palpite < numero_secreto:
10+
print("Muito baixo!")
11+
elif palpite > numero_secreto:
12+
print("Muito alto!")
13+
else:
14+
print(f"Parabéns! Você acertou o número em {tentativas} tentativas.")
15+
break
16+
17+
jogo_adivinhacao()

0 commit comments

Comments
 (0)