Codigo
Codigo
import random
import time
import pandas as pd
class usuario:
def __init__(self):
self.disponibles = []
self.fueraservicio = []
self.ocupados = []
self.emisor = []
self.tiempo = []
self.costo = []
def abonadosfueraservicio(self):
for i in range(1, 4):
f = random.choice(self.disponibles)
self.fueraservicio.append(f)
self.disponibles.remove(f)
return self.fueraservicio
def abonadosocupados(self):
for i in range(1, 4):
o = random.choice(self.disponibles)
self.ocupados.append(o)
self.disponibles.remove(o)
print(" ")
print("Abonados Disponibles")
print(self.disponibles)
print(" ")
print("Abonados Fuera de Servicio")
print(self.fueraservicio)
print(" ")
print("Abonados Ocupados")
print(self.ocupados)
return self.ocupados
def seleccionaremisor(self):
e = random.choice(self.disponibles)
self.emisor.append(e)
return self.emisor
def hh(self):
q = self.tiempo
self.tiempo.append(q)
self.tiempo.remove(q)
return self.tiempo
def ll(self):
w = self.costo
self.costo.append(w)
self.costo.remove(w)
return self.costo
condicion = 'si'
df = pd.DataFrame()
while condicion == 'si':
numero = int(input('ingrese numero telefonico = '))
llamada = usuario()
llamada.clasificacion(numero)
emisor = llamada.seleccionaremisor()
receptor = numero
tiempo = llamada.hh()
costo = llamada.ll()
indice = ['1']
tabblafac = {'emisor': emisor, 'receptor': receptor, 'duracion en segundos':
tiempo, 'costo de llamada': costo}
df = df.append(pd.DataFrame(data=tabblafac, index=indice, columns=['emisor',
'receptor', 'duracion en segundos', 'costo de llamada']), ignore_index=True)
print (df)
condicion = input("¿desea intentarlo otra vez? ")
if condicion == 'no':
break
print("Cerrando programa")
-----------------------------------------------------------------------------------
------------------------------------------------------------------------------
Sea Breeze (Free Download) de Vlad Gluschenko está posteada bajo una licencia
Creative Commons.