Академический Документы
Профессиональный Документы
Культура Документы
INTELIGENCIA ARTIFICIAL
PRIMER PRCTICA CALIFICADA (ST-414 V)
INTEGRANTES:
GIRALDO SALINAS, Lizbeth Carol
20081172F
lizbethgiraldo18@gmail.com
Inteligencia Artificial
20104533J
noe.huamani.diaz@gmail.com
-II
Inteligencia Artificial
-II
Primera Prctica
1. Describir procedimiento para desarrollar un icono para
identificar carpetas del software Word, de 3 ejemplos de
su solucin
Inteligencia Artificial
-II
Inteligencia Artificial
-II
Inteligencia Artificial
-II
Inteligencia Artificial
-II
def agregar(n):
historico[n-1]=historico[n-1]+1
def valnum(m):
if not m.isdigit():
return False
elif int(m)>45 or int(m)<0:
return False
return True
def opcion1():
Inteligencia Artificial
-II
os.system(['clear','cls'][os.name == 'nt'])
print '=====================OPCION 1====================='
nums=raw_input("\nIngrese el numero de sorteo:")
while not nums.isdigit():
nums=raw_input("Ingrese el numero de sorteo:")
num1=raw_input("1er numero:")
while not valnum(num1):
num1=raw_input("1er numero:")
agregar(int(num1))
num2=raw_input("2do numero:")
while not valnum(num2):
num2=raw_input("2do numero:")
agregar(int(num2))
num3=raw_input("3er numero:")
while not valnum(num3):
num3=raw_input("3er numero:")
agregar(int(num3))
num4=raw_input("4to numero:")
while not valnum(num4):
num4=raw_input("4to numero:")
agregar(int(num4))
num5=raw_input("5to numero:")
while not valnum(num5):
num5=raw_input("5to numero:")
agregar(int(num5))
num6=raw_input("6to numero:")
while not valnum(num6):
num6=raw_input("6to numero:")
agregar(int(num6))
numy=raw_input("Ingrese el numero de la yapa (si no hubo yapa en este sorteo, ingrese 0: ")
while not valnum(numy):
numy=raw_input("Ingrese el numero de la yapa (si no hubo yapa en este sorteo, ingrese 0:
")
array=[nums,
datetime.today(),int(num1),int(num2),int(num3),int(num4),int(num5),int(num6),int(numy)]
todo.append(array)
print 'Se registro correctamente el resultado'
xxx=raw_input()
iniciar()
def opcion2():
os.system(['clear','cls'][os.name == 'nt'])
print '=====================OPCION 2=====================\n'
for i in range(len(historico)):
print 'Numero',i+1,historico[i]
xxx=raw_input()
iniciar()
def opcion3():
os.system(['clear','cls'][os.name == 'nt'])
print '=====================OPCION 3====================='
ns=raw_input("\nIngrese el numero de sorteos a considerar en la busqueda:")
while not ns.isdigit():
ns=raw_input("Ingrese el numero de sorteos a considerar en la busqueda:")
temp = [0]*45
for j in range(len(todo)-int(ns),len(todo)):
pcom = todo[j]
temp[pcom[2]-1]=temp[pcom[2]-1]+1
temp[pcom[3]-1]=temp[pcom[3]-1]+1
Inteligencia Artificial
-II
temp[pcom[4]-1]=temp[pcom[4]-1]+1
temp[pcom[5]-1]=temp[pcom[5]-1]+1
temp[pcom[6]-1]=temp[pcom[6]-1]+1
temp[pcom[7]-1]=temp[pcom[7]-1]+1
print ''
for k in range(len(temp)):
print 'Numero',k+1,temp[k]
xxx=raw_input()
iniciar()
def opcion4():
os.system(['clear','cls'][os.name == 'nt'])
print '=====================OPCION 4=====================\n'
print 'Ingrese sus 6 numeros de la suerte y averigue si ya han sido ganadores\n'
temp=[]
num1=raw_input("1er numero:")
while not valnum(num1):
num1=raw_input("1er numero:")
temp.append(int(num1))
num2=raw_input("2do numero:")
while not valnum(num2):
num2=raw_input("2do numero:")
temp.append(int(num2))
num3=raw_input("3er numero:")
while not valnum(num3):
num3=raw_input("3er numero:")
temp.append(int(num3))
num4=raw_input("4to numero:")
while not valnum(num4):
num4=raw_input("4to numero:")
temp.append(int(num4))
num5=raw_input("5to numero:")
while not valnum(num5):
num5=raw_input("5to numero:")
temp.append(int(num5))
num6=raw_input("6to numero:")
while not valnum(num6):
num6=raw_input("6to numero:")
temp.append(int(num6))
temp.sort()
idxenc=-1
for plop in range(len(todo)):
sorteo=todo[plop]
seq=sorteo[2:8]
seq.sort()
flag2=True
for idx in range(0,5):
if temp[idx] == seq[idx]:
continue
else:
flag2=False
Inteligencia Artificial
-II
break
if flag2:
idxenc=plop
break
if idxenc == -1:
print 'No se encontro ningun resultado con los numeros ingresados'
else:
qui=todo[idxenc]
num=qui[0]
fecha=qui[1]
print 'Los numeros fueron ganadores en el sorteo',num,'el',fecha.strftime("%d/%m/%y")
xxx=raw_input()
iniciar()
for resultado in todo:
agregar(resultado[2])
agregar(resultado[3])
agregar(resultado[4])
agregar(resultado[5])
agregar(resultado[6])
agregar(resultado[7])
iniciar()
b)
import os
import sys
from datetime import datetime, date
historico=[0]*45
todo=[]
def iniciar():
os.system(['clear','cls'][os.name == 'nt'])
a=raw_input("Elegir una opcion:\n
1.Ingresar resultado de la Tinka\n
2.Mostrar
frecuencia de los numeros\n
3.Mostrar frecuencia de los numeros en los n sorteos
anteriores\n 4.Averigue si sus numeros han sido ganadores\n 5.Salir\n
Ingrese su
opcion: ")
while a<'1' or a>'5':
os.system(['clear','cls'][os.name == 'nt'])
a=raw_input("Elegir una opcion:\n 1.Ingresar resultado de la Tinka\n 2.Mostrar
frecuencia de los numeros\n
3.Mostrar frecuencia de los numeros en los n sorteos
anteriores\n 4.Averigue si sus numeros han sido ganadores\n 5.Salir\n
Ingrese su
opcion: ")
opcion = int(a)
print opcion
10
Inteligencia Artificial
-II
if opcion == 1:
opcion1()
elif opcion == 2:
opcion2()
elif opcion == 3:
opcion3()
elif opcion == 4:
opcion4()
elif opcion == 5:
sys.exit
def agregar(n):
historico[n-1]=historico[n-1]+1
def valnum(m):
if not m.isdigit():
return False
elif int(m)>45 or int(m)<0:
return False
return True
def opcion1():
os.system(['clear','cls'][os.name == 'nt'])
print '=====================OPCION 1====================='
nums=raw_input("\nIngrese el numero de sorteo:")
while not nums.isdigit():
nums=raw_input("Ingrese el numero de sorteo:")
num1=raw_input("1er numero:")
while not valnum(num1):
num1=raw_input("1er numero:")
agregar(int(num1))
num2=raw_input("2do numero:")
while not valnum(num2):
num2=raw_input("2do numero:")
agregar(int(num2))
num3=raw_input("3er numero:")
while not valnum(num3):
num3=raw_input("3er numero:")
agregar(int(num3))
num4=raw_input("4to numero:")
while not valnum(num4):
num4=raw_input("4to numero:")
agregar(int(num4))
num5=raw_input("5to numero:")
while not valnum(num5):
num5=raw_input("5to numero:")
agregar(int(num5))
num6=raw_input("6to numero:")
while not valnum(num6):
num6=raw_input("6to numero:")
agregar(int(num6))
numy=raw_input("Ingrese el numero de la yapa (si no hubo yapa en este sorteo, ingrese
0: ")
while not valnum(numy):
11
Inteligencia Artificial
-II
12
Inteligencia Artificial
-II
num4=raw_input("4to numero:")
while not valnum(num4):
num4=raw_input("4to numero:")
temp.append(int(num4))
num5=raw_input("5to numero:")
while not valnum(num5):
num5=raw_input("5to numero:")
temp.append(int(num5))
num6=raw_input("6to numero:")
while not valnum(num6):
num6=raw_input("6to numero:")
temp.append(int(num6))
temp.sort()
idxenc=-1
for plop in range(len(todo)):
sorteo=todo[plop]
seq=sorteo[2:8]
seq.sort()
flag2=True
for idx in range(0,5):
if temp[idx] == seq[idx]:
continue
else:
flag2=False
break
if flag2:
idxenc=plop
break
if idxenc == -1:
print 'No se encontro ningun resultado con los numeros ingresados'
else:
qui=todo[idxenc]
num=qui[0]
fecha=qui[1]
print 'Los numeros fueron ganadores en el sorteo',num,'el',fecha.strftime("%d/%m/%y")
xxx=raw_input()
iniciar()
for resultado in todo:
agregar(resultado[2])
agregar(resultado[3])
agregar(resultado[4])
agregar(resultado[5])
agregar(resultado[6])
agregar(resultado[7])
iniciar()
La imagen que demuestra el resultado es:
13
Inteligencia Artificial
-II
Store
Procedure
Frecuencia y
Probabilidad
de Nmeros
Frecuencia y
Probabilidad
de Nmeros
14