Add docs Python Total
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
from random import randint
|
||||
|
||||
intentos = 0
|
||||
estimado = 0
|
||||
numero_secreto = randint(1,100)
|
||||
nombre = input("Dime tu nombre: ")
|
||||
|
||||
print(f"Bueno {nombre}, he pensado un número entre 1 y 100\nTienes 8 intentos para adivinar")
|
||||
|
||||
while intentos < 8:
|
||||
estimado = int(input("Cuál es el número?: "))
|
||||
intentos += 1
|
||||
|
||||
if estimado < numero_secreto:
|
||||
print("Mi numero es mas alto")
|
||||
elif estimado > numero_secreto:
|
||||
print("Mi numero es mas bajo")
|
||||
else:
|
||||
print(f"Felicitaciones {nombre}! Has adivinado en {intentos} intentos")
|
||||
break
|
||||
|
||||
if estimado != numero_secreto:
|
||||
print(f"Lo siento, se han agotado los intentos. El numero secreto era {numero_secreto}")
|
||||
Reference in New Issue
Block a user