-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtut41.py
More file actions
62 lines (52 loc) · 1.04 KB
/
tut41.py
File metadata and controls
62 lines (52 loc) · 1.04 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
class Pila(object):
def __init__(self):
self.items=[]
def apilar(self, dato):
self.items.append(dato)
def desapilar(self):
if self.esta_vacia():
return None
else:
return self.items.pop()
def esta_vacia(self):
if len(self.items)==0:
return True
else:
return False
class Cola(object):
def __init__(self):
self.items=[]
def encolar(self,x):
self.items.append(x)
def esta_vacia(self):
if len(self.items)==0:
return True
else:
return False
def desencolar(self):
if self.esta_vacia():
return None
else:
return self.items.pop(0)
def recepcion():
cola1=Cola()
print "Bienvenido"
while True:
print "1-Agregar Nuevo Paciente"
print "2-Llamar al prox Paciente"
print "3-Cantidad de pacientes"
print "4-salir"
x=raw_input(" ?")
x=int(x)
if x==1:
paciente=raw_input("nombre del paciente? ")
cola1.encolar(paciente)
elif x==2:
print cola1.desencolar()
elif x==3:
print len(cola1.items)
elif x==4:
break
else:
print "ingrese una opcion valida"
recepcion()