You've already forked Curso-lenguaje-python
Restructure content and add notes from HolaMundo
Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
This commit is contained in:
71
python-total/dia_08/09_programa08/numeros.py
Normal file
71
python-total/dia_08/09_programa08/numeros.py
Normal file
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
Programa día 8 - Turnero
|
||||
|
||||
Generadores y decorador
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def perfumeria():
|
||||
""" Turnos de perfumeria """
|
||||
|
||||
turno_p = -1
|
||||
|
||||
while True:
|
||||
turno_p += 1
|
||||
yield f'P-{turno_p}'
|
||||
|
||||
|
||||
def farmacia():
|
||||
""" Turnos de farmacia """
|
||||
|
||||
turno_f = -1
|
||||
|
||||
while True:
|
||||
|
||||
turno_f += 1
|
||||
yield f'F-{turno_f}'
|
||||
|
||||
|
||||
def cosmetica():
|
||||
""" Turnos de cosmetica """
|
||||
|
||||
turno_c = -1
|
||||
while True:
|
||||
|
||||
turno_c += 1
|
||||
yield f'C-{turno_c}'
|
||||
|
||||
|
||||
def turnos(dpto):
|
||||
"""Turnos perfumeria"""
|
||||
|
||||
print('Su turno es ')
|
||||
|
||||
if dpto == 'perfumeria':
|
||||
|
||||
print(next(perf))
|
||||
|
||||
elif dpto == 'farmacia':
|
||||
|
||||
print(next(farm))
|
||||
|
||||
elif dpto == 'cosmetica':
|
||||
|
||||
print(next(cos))
|
||||
|
||||
else:
|
||||
print('Error')
|
||||
|
||||
print('Aguarde y será atendido')
|
||||
|
||||
|
||||
# Variables
|
||||
perf = perfumeria()
|
||||
farm = farmacia()
|
||||
cos = cosmetica()
|
||||
|
||||
|
||||
turnos('perfumeria')
|
||||
turnos('farmacia')
|
||||
turnos('cosmetica')
|
||||
Reference in New Issue
Block a user