Add docs Python Total
This commit is contained in:
1 parent
e81027cc44
commit
b942e84458
110 files changed
+31635
No files matched your search
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