-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumeroaleatorio.py
More file actions
25 lines (18 loc) · 822 Bytes
/
Copy pathnumeroaleatorio.py
File metadata and controls
25 lines (18 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Programa que genera un numero aleatorio e involucra al usuario para adiviniarlo
# Python practice ( @laborion)
# https://github.com/activeceron
import random
import os
aleatorio = random.randint(0,100)
print("\t.- JUEVO DEL NÚMERO ALEATORIO -.")
contador=0
while True:
numero=int(input("Introduzca el numero a adivinar de 0 a 100:"))
os.system ("cls")
contador+=1
if numero> aleatorio:
print(f"El numero introducido es mayor,inserta uno mas pequeño.\n Has hecho {contador} intentos")
elif numero<aleatorio:
print(f"El numero introducido es menor,inserta uno mas grande.\n Has hecho {contador} intentos")
else:
print(f"¡¡¡Enhorabuena,has acertado!!!,el numero es {aleatorio} y lo acertado en {contador} intentos.")