Curso-lenguaje-python/python-total/dia_08/09_programa08/numeros.py
Manuel Vergara f4e9797c4b Restructure content and add notes from HolaMundo
Signed-off-by: Manuel Vergara <manuel@vergaracarmona.es>
2023-05-20 09:36:26 +02:00

72 lines
920 B
Python

"""
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')