[LA MAQUINA ADIVINA TU NUMERO]

# -*- coding: utf-8 -*- from random import randint msgBienvenida="Bienvenidos a este ejercicio".title() print(msgBienvenida.center(60,"=")) intentos=0 numMayor=100 numMenor=1 verificar=[] print("piensa un numero y la maquina lo adivinara con tu ayuda") while True: intentos+=1 numMachine=randint(numMenor,numMayor) print(numMachine) if intentos >1: a=1 while a<2: for x in verificar: if x == numMachine: numMachine=randint(numMenor,numMayor) break elif x==verificar[-1]: a+=1 verificar.append(numMachine) inf= input ("\nN°De intentos:{0} \nla maquina ha arrojado este numero: {1} \n\n¿tu numero es mayor(S/N) o lo adivine(x)?:". format(intentos,numMachine)).lower() if inf == 's': numMenor=numMachine elif inf == 'n': numMayor=numMachine elif inf == 'x': print("La maquina ha ganado con: {0} intentos".format(intentos)) break else: print("ingresa un valor valido\n")
Corregido.
se ha corregido:
°>la maquina no enviara mas el mismo numero.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.