From ef67a816728648ec08128aa06764467eb475c6aa Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Sat, 6 Jan 2024 19:09:13 -0300 Subject: [PATCH 1/6] primer ejercicio --- exercise_1.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 exercise_1.py diff --git a/exercise_1.py b/exercise_1.py new file mode 100644 index 00000000..32853c0e --- /dev/null +++ b/exercise_1.py @@ -0,0 +1,76 @@ +"""1. Create an online banking system with the following features: + +* Users must be able to log in with a username and password. X +* If the user enters the wrong credentials three times, the system must lock them out. X +* The initial balance in the bank account is $2000. X +* The system must allow users to deposit, withdraw, view, and transfer money. X +* The system must display a menu for users to perform transactions. X """ + +print("Online Banking System") +print("Welcome to Bank of China!!!") +print() + +auth = False +username = input("Entry you username: ") +password = input("Entry you password: ") + +if username == "Lucas" and password == "tortadericota": + auth = True +else: + print("Try again you have 2 trie left") + print() + print("Insert you username") + username = input() + print("Insert you password") + password = input() + if username == "Lucas" and password == "tortadericota": + auth = True + else: + print("Try again you have 1 trie left") + print() + print("Insert you username") + username = input() + print("Insert you password") + password = input() + if username == "Lucas" and password == "tortadericota": + auth = True + else: + print("You are block broooo") + + +if auth: + print("Welcome banking navigator!!") + userbalance = 2000 + + print("1 -> view") + print("2 -> deposit") + print("3 -> withdraw") + print("4 -> transfer money") + print("5 -> exit") + + option = input() + + if option == "1": + print(f"you balance is {userbalance}") + elif option == "2": + print("Insert you deposit") + deposit = int(input()) + userbalance += deposit + print(f"you balance is {userbalance}") + elif option == "3": + print("how much you take?") + withdraw = int(input()) + userbalance -= withdraw + print(f"you balance is {userbalance}") + elif option == "4": + print("transfer ok how much?") + transferencia = int(input()) + userbalance -= transferencia + print(f"you was trasnfer {transferencia} and your balance is {userbalance} ") + elif option == "5": + print("Goodbye china banker") + else: + print("Invalid choise") + + + From fcdab86678052b9a80772cf52039b904377d5cf8 Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Mon, 8 Jan 2024 02:57:01 -0300 Subject: [PATCH 2/6] Ejercicio numero 2 resuelto --- exercise_2.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 exercise_2.py diff --git a/exercise_2.py b/exercise_2.py new file mode 100644 index 00000000..795cae29 --- /dev/null +++ b/exercise_2.py @@ -0,0 +1,64 @@ +"""2. Create a currency converter between CLP, ARS, USD, EUR, TRY, GBP with the following features: +* The user must choose their initial currency and the currency they want to exchange to. +* The user can choose whether or not to withdraw their funds. If they choose not to withdraw, + it should return to the main menu. +* If the user decides to withdraw the funds, the system will charge a 1% commission. +* Set a minimum and maximum amount for each currency, it can be of your choice. X +* The system should ask the user if they want to perform another operation. If they choose to do so, + it should restart the process; otherwise, the system should close.""" + + +print("Currency Converter") +print() + +exchange_rates = { + 'CLP': 0.0030, + 'ARS': 0.020, + 'USD': 1.0, + 'EUR': 1.15, + 'TRY': 0.15, + 'GBP': 1.35, +} +commission_rate = 0.01 + +min_amount = { + 'CLP': 5, + 'ARS': 5, + 'USD': 5, + 'EUR': 5, + 'TRY': 5, + 'GBP': 5, +} +max_amount = { + 'CLP': 20000, + 'ARS': 20000, + 'USD': 20000, + 'EUR': 20000, + 'TRY': 20000, + 'GBP': 20000, +} + +while True: + + from_currency = input("Insert you currency initial (for example, ARG): ") + to_currency = input("Insert the coin to change (for example, GBP): ") + + amount = float(input(f"Enter the amount in {from_currency}: ")) + + if amount < min_amount[from_currency] or amount > max_amount[from_currency]: + print(f"Enter the amount in {min_amount[from_currency]} y {max_amount[from_currency]} {from_currency}.") + continue + + withdraw_funds = input("¿withdraw their funds? (yes/no): ") == 'yes' + + if withdraw_funds: + converted_amount = amount * exchange_rates[to_currency] * (1 - commission_rate) + print(f"Amount converted after a 1% commission: {converted_amount:.3f} {to_currency}") + else: + converted_amount = amount * exchange_rates[to_currency] + print(f"Amount converted: {converted_amount:.3f} {to_currency}") + + another_operation = input("¿Do you want to perform another operation? (yes/no): ") + if another_operation != 'yes': + print("See so bro!!!") + break \ No newline at end of file From ba75207ef5e697a74ff52f13fa9ea97a5e29129b Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Mon, 8 Jan 2024 03:05:09 -0300 Subject: [PATCH 3/6] level 0 --- level_0.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/level_0.txt b/level_0.txt index 46810130..a3c522cc 100644 --- a/level_0.txt +++ b/level_0.txt @@ -7,7 +7,7 @@ Username: @blindma1den * If the user enters the wrong credentials three times, the system must lock them out. * The initial balance in the bank account is $2000. * The system must allow users to deposit, withdraw, view, and transfer money. -* The system must display a menu for users to perform transactions.


2. +* The system must display a menu for users to perform transactions.2. 2. Create a currency converter between CLP, ARS, USD, EUR, TRY, GBP with the following features: * The user must choose their initial currency and the currency they want to exchange to. @@ -32,7 +32,7 @@ Username: @blindma1den * To send a package, sender and recipient details are required. * The system assigns a random package number to each sent package. * The system calculates the shipping price. $2 per kg. -* The user must input the total weight of their package, and the system should display the amount to pay.

 +* The user must input the total weight of their package, and the system should display the amount to pay. * The system should ask if the user wants to perform another operation. If the answer is yes, it should return to the main menu. If it's no, it should close the system. From 75ab6ccf65603893419050fcc57753dc096e1c17 Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Mon, 8 Jan 2024 05:12:52 -0300 Subject: [PATCH 4/6] Ejercicio numero 4 listo --- exercise_4.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 exercise_4.py diff --git a/exercise_4.py b/exercise_4.py new file mode 100644 index 00000000..68be2478 --- /dev/null +++ b/exercise_4.py @@ -0,0 +1,69 @@ +"""4. Create an online shipping system with the following features: +* The system has a login that locks after the third failed attempt. X +* Display a menu that allows: Sending a package, exiting the system. X +* To send a package, sender and recipient details are required. +* The system assigns a random package number to each sent package. +* The system calculates the shipping price. $2 per kg. +* The user must input the total weight of their package, + and the system should display the amount to pay. +* The system should ask if the user wants to perform another operation. If the answer is yes, + it should return to the main menu. If it's no, it should close the system.""" + +import random + +auth = False +username = input("Entry you username: ") +password = input("Entry you password: ") + +if username == "Gabitoto" and password == "tortadericota": + auth = True +else: + print("Try again you have 2 trie left") + print() + print("Insert you username") + username = input() + print("Insert you password") + password = input() + if username == "Gabitoto" and password == "tortadericota": + auth = True + else: + print("Try again you have 1 trie left") + print() + print("Insert you username") + username = input() + print("Insert you password") + password = input() + if username == "Gabitoto" and password == "tortadericota": + auth = True + else: + print("You are blocked!!!!") +if auth: + print("Welcome!!") + while True: + print("---> Shipping System <---") + print("1 <--- Sending a package") + print("2 <--- exiting the system") + choise = input("-------> ") + if choise == "2": + print("Goodbye, see you soon!!") + break + elif choise == "1": + sender_details = input("Enter sender details: ") + recipient_details = input("Enter recipient details: ") + + package_number = random.randint(1000, 9999) + + peso = int(input("wheight of product: ")) + + costo_total = 2 * (peso) + + print(f"The sender is {sender_details} and this recipient is {recipient_details}") + print(f"\nnumber of packeage: {package_number}") + print(f"shipping price: ${costo_total:.2f}") + else: + print("not valid choise!!!!.\n") + + another_operation = input("Do you want to perform another operation? (yes/no): ") + if another_operation != 'yes': + print("Goodbye, see you soon!!") + break \ No newline at end of file From a24363327a3359264233cf8583746c65a1634f1e Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Wed, 10 Jan 2024 04:16:36 -0300 Subject: [PATCH 5/6] ejercicio 5 finalizado --- exercise_5.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 exercise_5.py diff --git a/exercise_5.py b/exercise_5.py new file mode 100644 index 00000000..d494656f --- /dev/null +++ b/exercise_5.py @@ -0,0 +1,111 @@ +"""5. Develop a finance management application with the following features: +* The user records their total income. +* There are categories: Medical expenses, household expenses, leisure, savings, and education. +* The user can list their expenses within the categories and get the total for each category. +* The user can obtain the total of their expenses. +* If the user spends the same amount of money they earn, + the system should display a message advising the user to reduce expenses in the category where they have spent the most money. +* If the user spends less than they earn, + the system displays a congratulatory message on the screen. +* If the user spends more than they earn, + the system will display advice to improve the user's financial health.""" + + +medical_expenses = [] +household_expenses = [] +laisure_list = [] +saving_list = [] +education_list = [] + + +def medical(medical_expenses): + medical_expenses_join = int(input("Medical expenses> ")) + medical_expenses.append(medical_expenses_join) + print(medical_expenses) + +def household(household_expenses): + household_expenses_join = int(input("household expenses: ")) + household_expenses.append(household_expenses_join) + print(household_expenses) + +def laisure(laisure_list): + laisure_join = int(input("join laisure expenses: ")) + laisure_list.append(laisure_join) + print(f"you expensis are {laisure_list}") + +def saving(saving_list): + saving_join = int(input("enter saiving money: ")) + saving_list.append(saving_join) + print(saving_list) + +def education(education_list): + education_join = int(input("entry you education expenses: ")) + education_list.append(education_join) + print(education_list) + +def record_income(education,saving,laisure,household,medical): + print("Insert your expenses by category...") + med = medical(medical_expenses) + hous = household(household_expenses) + lai = laisure(laisure_list) + sav = saving(saving_list) + edu = education(education_list) + print(med,hous,lai,sav,edu) + +def sum_lists(*lists): + # Verifica que todas las listas tengan la misma longitud + list_lengths = set(len(lst) for lst in lists) + if len(list_lengths) != 1: + raise ValueError("All input lists must have the same length.") + + result = [sum(lst) for lst in lists] + return result + +def analyze_financial_health(medical_expenses,household_expenses,laisure_list,saving_list,education_list,salary_neto): + categories = [ + ("Gastos médicos", sum(medical_expenses)), + ("Gastos del hogar", sum(household_expenses)), + ("Gastos de ocio", sum(laisure_list)), + ("Gastos de ahorros", sum(saving_list)), + ("Gastos de educación", sum(education_list)) + ] + + for category, total_expense in categories: + status = "Good" if total_expense < salary_neto else "Not good" + print(f"{category}: {status}") + +def menu(): + print("Menu") + print("1----Insert you expenses by categories") + print("2----calculate you expenses") + print("3----Recomendations") + print("4----exit") + + + +print("Finance Management Application") +print() + +salary_neto = int(input("Join your salary> ")) +print(salary_neto) + +while True: + menu() + choice = input("Select one option (1-4): ") + + if choice == '1': + income = record_income(education,saving,laisure,household,medical) + elif choice == '2': + result_list = sum_lists(medical_expenses, household_expenses, laisure_list,saving_list,education_list) + print("Sum of lists:", result_list) + elif choice == '3': + analyze_financial_health(medical_expenses,household_expenses,laisure_list,saving_list,education_list,salary_neto) + elif choice == '4': + print("¡Good Bye!") + break + else: + print("Error 404.") + break + + + From 2088efeca97d250d3e30f5265d35d748f8cf594d Mon Sep 17 00:00:00 2001 From: Lucas G <133524925+Gabitoto@users.noreply.github.com> Date: Tue, 16 Jan 2024 00:58:55 -0300 Subject: [PATCH 6/6] Completo --- exercise_3.py | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 exercise_3.py diff --git a/exercise_3.py b/exercise_3.py new file mode 100644 index 00000000..cdf06716 --- /dev/null +++ b/exercise_3.py @@ -0,0 +1,113 @@ +"""3. Create an university enrollment system with the following characteristics: +* The system has a login with a username and password. +* Upon logging in, a menu displays the available programs: Computer Science, Medicine, Marketing, + and Arts. +* The user must input their first name, last name, and chosen program. +* Each program has only 5 available slots. The system will store the data of each registered user, + and if it exceeds the limit, it should display a message indicating the program is unavailable. +* If login information is incorrect three times, the system should be locked. +* The user must choose a campus from three cities: London, Manchester, Liverpool. +* In London, there is 1 slot per program; in Manchester, there are 3 slots per program, and in Liverpool, + there is 1 slot per program. +* If the user selects a program at a campus that has no available slots, + the system should display the option to enroll in the program at another campus.""" + +print("university enrollment system") + +class SistemaInscripcion: + def __init__(self): + self.programas = { + 'Ciencias de la Computación': {'Londres': 1, 'Manchester': 3, 'Liverpool': 1}, + 'Medicina': {'Londres': 1, 'Manchester': 3, 'Liverpool': 1}, + 'Marketing': {'Londres': 1, 'Manchester': 3, 'Liverpool': 1}, + 'Artes': {'Londres': 1, 'Manchester': 3, 'Liverpool': 1}, + } + self.usuarios = {} + self.intentos_inicio_sesion = 0 + self.max_intentos_inicio_sesion = 3 + + def inicio_sesion(self): + usuario = input("Ingrese su nombre de usuario: ") + contrasena = input("Ingrese su contraseña: ") + + if usuario == "lucas" and contrasena == "12345": + self.mostrar_menu_programas() + elif usuario == "martin" and contrasena == "123": + self.mostrar_menu_programas() + else: + print("Nombre de usuario o contraseña incorrectos.") + self.intentos_inicio_sesion += 1 + if self.intentos_inicio_sesion >= self.max_intentos_inicio_sesion: + print("Demasiados intentos de inicio de sesión. El sistema está bloqueado.") + exit() + self.inicio_sesion() + + def mostrar_menu_programas(self): + while True: + print("Programas disponibles:") + for programa in self.programas: + print(f"- {programa}") + + programa_elegido = input("Ingrese el nombre del programa en el que desea inscribirse: ") + + if programa_elegido not in self.programas: + print("Programa inválido. Por favor, elija entre los programas disponibles.") + continue + + campus = input("Elija un campus (Londres, Manchester, Liverpool): ") + if campus not in ['Londres', 'Manchester', 'Liverpool']: + print("Campus inválido. Por favor, elija entre Londres, Manchester o Liverpool.") + continue + + if self.programas[programa_elegido][campus] > 0: + self.inscribir_usuario(programa_elegido, campus) + else: + print(f"No hay espacios disponibles para {programa_elegido} en {campus}.") + self.inscribir_en_otro_campus(programa_elegido) + + def inscribir_usuario(self, programa, campus): + nombre = input("Ingrese su nombre: ") + apellido = input("Ingrese su apellido: ") + + if programa not in self.usuarios: + self.usuarios[programa] = {} + + if campus not in self.usuarios[programa]: + self.usuarios[programa][campus] = [] + + if len(self.usuarios[programa][campus]) < 5: + self.usuarios[programa][campus].append({'Nombre': nombre, 'Apellido': apellido}) + print(f"Inscripción exitosa para {nombre} {apellido} en {programa} en {campus}.") + self.preguntar_otro_usuario() + else: + print(f"Lo siento, no hay espacios disponibles para {programa} en {campus}.") + self.inscribir_en_otro_campus(programa) + + def inscribir_en_otro_campus(self, programa): + while True: + cambiar_campus = input(f"¿Desea inscribirse en {programa} en otro campus? (sí/no): ").lower() + if cambiar_campus == 'sí': + break + elif cambiar_campus == 'no': + print("Volviendo al menú principal.") + return + else: + print("Por favor, ingrese 'sí' o 'no'.") + + def preguntar_otro_usuario(self): + while True: + otro_usuario = input("¿Desea registrar a otro usuario? (sí/no): ").lower() + if otro_usuario == 'sí': + self.inicio_sesion() + elif otro_usuario == 'no': + print("Gracias por usar el sistema de inscripción.") + exit() + else: + print("Por favor, ingrese 'sí' o 'no'.") + + +if __name__ == "__main__": + sistema_inscripcion = SistemaInscripcion() + sistema_inscripcion.inicio_sesion() + + \ No newline at end of file