-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejercicio-tickets.py
More file actions
52 lines (41 loc) · 1.32 KB
/
Copy pathejercicio-tickets.py
File metadata and controls
52 lines (41 loc) · 1.32 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
# *Ahora quiero hacer la misma función pero con validación en los datos de entrada y que funcione como un programa
from datetime import date
from datetime import timedelta
# def variable global
contadorTickets = 0
def generarTicket(fecha, hora, cancha, telefono, correo):
# Aumentar el contador de tickets
global contadorTickets
contadorTickets += 1
# Generar el ticket
ticket = f"""
Fecha: {fecha}
Hora: {hora}
Ticket: {contadorTickets}
Cancha: {cancha}
Telefono: {telefono}
Correo: {correo}
"""
# Retornar el ticket
return ticket
def semanaSiguiente():
#Devuelve en consola cada dia de la semana siguiente a la fecha actual
for i in range(7):
print(f"""{i}-{date.today() + timedelta(days=i)}""")
print("BIenvenido al sistema de tickets")
print("Que desea realizar?")
print("1- Generar un turno")
print("2- Consultar un turno")
print("3- Salir")
# input de entero
selectMenu = input("Ingrese una opción: ")
while not selectMenu.isdigit():
print("Ingrese una opción válida")
selectMenu = input("Ingrese una opción: ")
# convertir a entero
selectMenu = int(selectMenu)
if selectMenu == 1:
print("Ingrese los datos del turno a generar")
print("Seleccione la fecha:")
##Mostrar 1 sem en adelante al dia de hoy
semanaSiguiente()