From 21c8b6c5606b37c78f27222541b2ad420a407631 Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Mon, 22 Jan 2024 00:53:26 -0300 Subject: [PATCH 1/6] Terminado el ejercicio 1 --- exercise_1.py | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 exercise_1.py diff --git a/exercise_1.py b/exercise_1.py new file mode 100644 index 0000000..262484c --- /dev/null +++ b/exercise_1.py @@ -0,0 +1,104 @@ +print("EXERCISE 1") + +class Jugador: + def __init__(self, nombre, goles, velocidad, asistencias, precision_pase, involucramientos_defensivos, numero_camiseta): + self.nombre = nombre + self.goles = goles + self.velocidad = velocidad + self.asistencias = asistencias + self.precision_pase = precision_pase + self.involucramientos_defensivos = involucramientos_defensivos + self.numero_camiseta = numero_camiseta + +jugadores = [ + Jugador("Bruno Fernandes", 5, 6, 9, 10, 3, 8), + Jugador("Rasmus Hojlund", 12, 8, 2, 6, 2, 11), + Jugador("Harry Maguire", 1, 5, 1, 7, 9, 5), + Jugador("Alejandro Garnacho", 8, 7, 8, 6, 0, 17), + Jugador("Mason Mount", 2, 6, 4, 8, 1, 7) +] + +def mostrar_menu(): + print("\nMenú Principal:") + print("1. Revisar Jugador") + print("2. Comparar dos Jugadores") + print("3. Identificar al Jugador más Rápido") + print("4. Identificar al Máximo Goleador") + print("5. Identificar al Jugador con más Asistencias") + print("6. Identificar al Jugador con Mayor Precisión de Pase") + print("7. Identificar al Jugador con más Involucramientos Defensivos") + print("8. Salir") + +def revisar_jugador(numero_camiseta): + for jugador in jugadores: + if jugador.numero_camiseta == numero_camiseta: + print("\nDetalles de", jugador.nombre) + print("Goles:", jugador.goles) + print("Velocidad:", jugador.velocidad) + print("Asistencias:", jugador.asistencias) + print("Precisión de Pase:", jugador.precision_pase) + print("Involucramientos Defensivos:", jugador.involucramientos_defensivos) + return + print("Número de camiseta no encontrado.") + +def comparar_jugadores(num_camiseta1, num_camiseta2): + jugador1 = None + jugador2 = None + + for jugador in jugadores: + if jugador.numero_camiseta == num_camiseta1: + jugador1 = jugador + elif jugador.numero_camiseta == num_camiseta2: + jugador2 = jugador + + if jugador1 and jugador2: + print("\nComparación entre", jugador1.nombre, "y", jugador2.nombre) + print("Goles:", jugador1.goles, "vs", jugador2.goles) + print("Velocidad:", jugador1.velocidad, "vs", jugador2.velocidad) + print("Asistencias:", jugador1.asistencias, "vs", jugador2.asistencias) + print("Precisión de Pase:", jugador1.precision_pase, "vs", jugador2.precision_pase) + print("Involucramientos Defensivos:", jugador1.involucramientos_defensivos, "vs", jugador2.involucramientos_defensivos) + else: + print("Número de camiseta no encontrado.") + +def identificar_maximo(atributo): + max_valor = -1 + max_jugador = None + + for jugador in jugadores: + valor = getattr(jugador, atributo) + if valor > max_valor: + max_valor = valor + max_jugador = jugador + + print("\nJugador con", atributo.capitalize(), "más alto:", max_jugador.nombre, "(", max_valor, "puntos)") + +while True: + mostrar_menu() + opcion = input("\nSeleccione una opción (1-8): ") + + if opcion == '1': + num_camiseta = int(input("\nIngrese el número de camiseta del jugador: ")) + revisar_jugador(num_camiseta) + elif opcion == '2': + num_camiseta1 = int(input("\nIngrese el número de camiseta del primer jugador: ")) + num_camiseta2 = int(input("Ingrese el número de camiseta del segundo jugador: ")) + comparar_jugadores(num_camiseta1, num_camiseta2) + elif opcion == '3': + identificar_maximo('velocidad') + elif opcion == '4': + identificar_maximo('goles') + elif opcion == '5': + identificar_maximo('asistencias') + elif opcion == '6': + identificar_maximo('precision_pase') + elif opcion == '7': + identificar_maximo('involucramientos_defensivos') + elif opcion == '8': + print("\n¡Hasta luego!") + break + else: + print("\nOpción no válida. Por favor, seleccione una opción del 1 al 8.") + + +"""con esto se termina el numero 1""" \ No newline at end of file From 08e8429a680129b39884d9a325a67bcc14afde7e Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Thu, 1 Feb 2024 17:53:06 -0300 Subject: [PATCH 2/6] ejercicio completo --- exercise_2.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 exercise_2.py diff --git a/exercise_2.py b/exercise_2.py new file mode 100644 index 0000000..20fc411 --- /dev/null +++ b/exercise_2.py @@ -0,0 +1,73 @@ +"""2. A travel agency has a special offer for traveling in any season of 2024. Their destinations are: + +Winter: Andorra and Switzerland. In Andorra, there are skiing activities, and in Switzerland, there's a tour of the Swiss Alps. +Summer: Spain and Portugal. In Spain, there are hiking and extreme sports activities. In Portugal, + there are activities on the beaches. +Spring: France and Italy. In France, there are extreme sports activities, and in Italy, + there's a cultural and historical tour. +Autumn: Belgium and Austria. In Belgium, there are hiking and extreme sports activities, and in Austria, + there are cultural and historical activities. +Note: Traveling in winter costs $100, in autumn $200, in spring $300, and in summer $400. + +Design a system that helps users choose their best destination according to their personal preferences and the season they want to travel in. +12. Important: With the information you have, you should ask the user the right questions and display on screen what their best destination would be. + +Clue: You could consider the user's budget""" + +while True: + print("Travel season 2024") + print() + print("system that helps users choose their best destination according to their personal preferences and the season they want to travel in") + print("ok do you want continues?") + answer = input("yes or not?: ") + if answer == "yes": + print("okay") + else: + print("good bye") + exit() + print() + print("first tell us how much is your budget") + budget = int(input("Insert your budget for this travel: ")) #int + print() + print("okay now when you travel?") + date = (input("season of your travel: ")) #string + print() + print("and finally what activities you prefer?") + activities = input("What activity would you like to do on your trip? Sport activities or cultural activities: ") #string + print() + print(f"okay your budget is {budget} and you travel on the {date},the activited you selected are {activities}") + + if date == "winter" and activities == "sport activities": + print(f"i recomend you a trip to Andorra, for this trip the cost will by $100 and your budget is {budget}.") + continue + elif date == "winter" and activities == "cultural activities": + print(f"i recomend you a trip to Switzerland, for this trip the cost will by $100 and your budget is {budget}") + continue + elif date == "summer" and activities == "sport activities": + print(f"i recomend you a trip to Spain, for this trip the cost will by $400 and your budget is {budget}") + continue + elif date == "summer" and activities == "cultural activities": + print(f"i recomend you a trip to Portugal, for this trip the cost will by $400 and your budget is {budget}") + continue + elif date == "spring" and activities == "sport activities": + print(f"i recomend you a trip to France, for this trip the cost will by $300 and your budget is {budget}") + continue + elif date == "spring" and activities == "cultural activities": + print(f"i recomend you a trip to Italy, for this trip the cost will by $300 and your budget is {budget}") + continue + elif date == "autumn" and activities == "sport activities": + print(f"i recomend you a trip to Belgium, for this trip the cost will by $200 and your budget is {budget}") + continue + elif date == "autumn" and activities == "cultural activities": + print(f"i recomend you a trip to Austria, for this trip the cost will by $200 and your budget is {budget}") + continue + else: + print("incorrect data") + break + + + + + + + From 5661f940f0789a4137b34e45d0746fba60839f53 Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:58:44 -0300 Subject: [PATCH 3/6] "holaaa" --- exercise_3.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 exercise_3.py diff --git a/exercise_3.py b/exercise_3.py new file mode 100644 index 0000000..16d51bd --- /dev/null +++ b/exercise_3.py @@ -0,0 +1,16 @@ +"""3. + +The Valencia Hospital is developing an application to manage appointments. Design an algorithm for this application with the following features: + +It must have a login and validate the data; after the third failed attempt, it should be locked. +The user can schedule an appointment for: General Medicine, Emergency Care, Clinical Analysis, Cardiology, Neurology, Nutrition, Physiotherapy, Traumatology, and Internal Medicine. +There are 3 doctors for each specialty. +The user can only book one appointment per specialist. An error message should be displayed if the user tries to choose two appointments with the same doctor or the same specialty. As a developer, you can choose the doctors' names. +The maximum limit for appointments, in general, is 3. +Upon selecting a specialty, it will display if the user prefers a morning or afternoon appointment and show available hours. As a developer, you can choose the hours. +Display available specialists. +The user can choose their preferred specialist. +The basic process is: Login -> Choose specialty -> Choose doctor -> Choose time slot.""" + + +print("hello") \ No newline at end of file From 6ab230b30502b7a45fbcdf595f41cf4fb88e25b8 Mon Sep 17 00:00:00 2001 From: Gabitoto Date: Mon, 2 Dec 2024 23:07:09 -0300 Subject: [PATCH 4/6] Seguimos con el Ejercicio N3 --- exercise_3.py | 1 - 1 file changed, 1 deletion(-) diff --git a/exercise_3.py b/exercise_3.py index 16d51bd..0029bba 100644 --- a/exercise_3.py +++ b/exercise_3.py @@ -13,4 +13,3 @@ The basic process is: Login -> Choose specialty -> Choose doctor -> Choose time slot.""" -print("hello") \ No newline at end of file From 1b2c12897f5afd9fc134d36669533706b6b9615f Mon Sep 17 00:00:00 2001 From: Gabitoto Date: Tue, 3 Dec 2024 00:16:04 -0300 Subject: [PATCH 5/6] Agrego clases y funciones para resolucion del problema --- exercise_3.py | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/exercise_3.py b/exercise_3.py index 0029bba..496a677 100644 --- a/exercise_3.py +++ b/exercise_3.py @@ -12,4 +12,70 @@ The user can choose their preferred specialist. The basic process is: Login -> Choose specialty -> Choose doctor -> Choose time slot.""" +import datetime + +# Hacemos una clase Hospital la cual va tener toda la informacion para validar y acceder a la misma con sus respectivos setter y getter + +class Hospital: + def __init__(self): + self.usuario = {"Lucas":12345,"Martin":1234,"Keila":123} + self.doctor = {"General Medicine":["juan","lucas","Gallo"],"Emergency Care":["jehova","david","jonathan"],"Clinical Analysis":["Lula","Milei","Trump"],"Cardiology":["marcos","facundo","Roberto"],"Neurology":["kian","Osiris","Liana"],"Nutrition":["Clarita","bulma","Kiara"],"Physiotherapy":["Sofia","Sabrina","delfina"],"Traumatology":["juana","Riana","Artemisa"],"Internal Medicine":["Raul","Lucio","Ambesa"]} + self.category = ["General Medicine", "Emergency Care", "Clinical Analysis", "Cardiology", "Neurology", "Nutrition", "Physiotherapy", "Traumatology", "Internal Medicine"] + self.appointments = {} # se agregaran las citas como datetime:[doctor,especialidad,usuario] + + + def validate_pass(self, usuario, password): + """Función que valida las contraseñas ingresadas""" + if usuario not in self.usuario: + raise ValueError("Usuario inválido") + if self.usuario[usuario] != password: + raise ValueError("Contraseña incorrecta") + return True # Si el usuario y la contraseña son correctos + + def validate_doctor(self, doctor, date_time): + """Función que valida si un doctor está disponible en una fecha y hora""" + if date_time in self.appointments: + # Verificamos si el doctor ya tiene una cita programada en esa fecha + for appointment in self.appointments[date_time]: + if appointment[0] == doctor: + raise ValueError(f"El doctor {doctor} ya tiene una cita a esta hora.") + else: + self.appointments[date_time] = [] # Crear una nueva lista de citas en esa hora + + return True + + def make_appointment(self, usuario, doctor, category, date_time): + """Función que permite al usuario hacer una cita""" + if self.validate_doctor(doctor, date_time): # Valida si el doctor está disponible + self.appointments[date_time].append([doctor, category, usuario]) + print(f"Cita confirmada con {doctor} para la categoría {category} a las {date_time}") + else: + print("El doctor no está disponible en este horario.") + + + +####################################### Aplicacion Principal ####################################### + +hospital = Hospital() + +# Primero validamos un usuario +try: + hospital.validate_pass("Lucas", 12345) + print("Usuario validado correctamente") +except ValueError as e: + print(f"Error: {e}") + +# Luego hacemos una cita +try: + # Hacemos una cita para el doctor "juan" en "General Medicine" a las 2024-12-03 10:00 + date_time = datetime.datetime(2024, 12, 3, 10, 0) + hospital.make_appointment("Lucas", "juan", "General Medicine", date_time) +except ValueError as e: + print(f"Error: {e}") + +# Intentamos hacer otra cita para el mismo doctor a la misma hora +try: + hospital.make_appointment("Martin", "juan", "Emergency Care", date_time) +except ValueError as e: + print(f"Error: {e}") From ee75ae6cef95b182c9726e13d206b8de2b04c839 Mon Sep 17 00:00:00 2001 From: Gabitoto Date: Tue, 10 Dec 2024 17:06:29 -0300 Subject: [PATCH 6/6] add file --- ejerciciosRandom.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ejerciciosRandom.py diff --git a/ejerciciosRandom.py b/ejerciciosRandom.py new file mode 100644 index 0000000..1c87cd2 --- /dev/null +++ b/ejerciciosRandom.py @@ -0,0 +1,26 @@ +def solucionarRompecabezas(N): + # Definimos un módulo grande para manejar el cálculo + MOD = 10**10 # Últimos 10 dígitos + + var_A = 1 + var_B = 1 + var_C = 1 + var_D = 1 + + for _ in range(1, N+1): + # Realizamos todos los cálculos con módulo para evitar desbordamiento + resultado = (3 * var_D + var_C + 4 * var_B + var_A) % MOD + var_A = var_B + var_B = var_C + var_C = var_D + var_D = resultado + + return var_D + +# Pruebas +print("solucionarRompecabezas(10):", solucionarRompecabezas(10)) +print("solucionarRompecabezas(100):", solucionarRompecabezas(100)) + +# Cálculo para 2023^100 +N = pow(2023, 100) +print("solucionarRompecabezas(2023^100):", solucionarRompecabezas(N)) \ No newline at end of file