Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
This repository contains exercises from a Discord community where the goal is to gain experience in development for people who don't have it.

Those are my resolutions.

# Programming-Skills-Level1

This repository is the second one of a series of entry-level exercises that can be solved in any programming language. The purpose of these exercises is to develop your programming logic. This repository is the first in a series of more exercises to improve your programming skills.
Expand Down
Binary file added __pycache__/modulos.cpython-311.pyc
Binary file not shown.
120 changes: 120 additions & 0 deletions ejercicio1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
columnas=["Nombre", "goles", "speed", "assist", "passing accuracy", "defense involments",
"jersey"]
bruno=["Bruno Fernandez", 5, 6 ,9,10, 3, 8]
rasmus=["Rasmus Hojlund", 12,8, 2,6,2,11]
maguire=["Harry Maguire", 1, 5, 1, 7, 9, 5]
garnacho=["Alejandro Garnacho", 8, 7, 8, 6, 0, 17]
mount=["Mason Mount", 2, 6, 4,8,1,7]

diccUsers={"haag":"1234"}

def login():
auth=0
oportunidades=3
while (auth==0 and oportunidades>0):
name=input("Ingrese su usuario: ")
clave=input ("Ingrese su contrasenia: ")
if clave==diccUsers.get(name):
auth=1
print(" ")
print ("Usuario logueado correctamente")
print(" ")
else:
print(" ")
print ("Clave Incorrecta")
print(" ")
oportunidades = oportunidades-1
if oportunidades==0:
salida(0)
return

def salida(motivo):
if motivo==0:
print ("\nNo es posible loguearlo.")
exit()
return

def menuPrincipal():
choise=None
while choise not in ["1","2","3", "4"]:
print("\nProgramas posibles.")
print("\n1. Player review\n2. Compare \n3. Tops \n4. Salir")
#3. fastest player \n4. top goal scorer \n5. player with the most assists \n6. player with the highest passing accuracy 7. player with the most defensive involvements")
choise=input("\nElija la opcion deseada: ")
return choise

def datosEnPantalla(datos,columnas):
i=0
print("\n")
for columna in columnas:
print(columna, ": ", datos[i])
i=i+1
return

def encontrarPosicion(bd, jersey):
found=False
pos=-1
for i in range(len(bd)):
if bd[i][6]==int(jersey):
datosEnPantalla(bd[i],bd[0])
found=True
pos=i
return found, pos

def mostrarJugador(bd): #Recibe una base de datos. Pide elegir un numero de camiseta y muestra por pantalla sus datos.
jersey=input("\nIngrese nro de camiseta: ")
found, posicion=encontrarPosicion(bd, jersey)
if found:
return
else:
print("No se ha encontrado el judagor")
return

def compararJugadores(bd):
jug1=""
jug2=" "
while jug1 not in ["8","11","5","17","7"] or jug2 not in ["8","11","5","17","7"] or jug1==jug2:
jug1=input("\nIngrese jersey del primer jugador: ")
jug2=input("\nIngrese jersey del jugador 2: ")
found1,pos1=encontrarPosicion(bd,jug1)
found2,pos2=encontrarPosicion(bd,jug2)

return

def maxim(bd, columna):
max=int(bd[1][columna])
jugador=1
for i in range(1,len(bd)):
if int(bd[i][columna])>max:
max=bd[i][columna]
jugador=i
print("el maximo en ", bd[0][columna], "es ", bd[jugador][0], "con ", bd[jugador][columna])

def tops(bd):
opcion=""
while opcion not in ["1", "2", "3", "4", "5", "6"]:
print("\n1. Fastest \n2. Goal Scorer \n3. asisst \4. passing accuracy \n5. defensive \n6. Salir")
opcion=input("\nElija la opcion deseada:")

if opcion in ["1", "2", "3", "4", "5"]:
maxim(bd,int(opcion))
else:
return

login()
data=[columnas,bruno, rasmus, maguire, garnacho, mount]
opcion=menuPrincipal()
while True:
if opcion=="1":
mostrarJugador(data)
opcion=menuPrincipal()
else:
if opcion=="2":
compararJugadores(data)
opcion=menuPrincipal()
else:
if opcion=="3":
tops(data)
opcion=menuPrincipal()
else:
exit()
53 changes: 53 additions & 0 deletions ejercicio2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Ejercicio 2

diccEstaciones = {"Winter": ["Andorra", "Switzerland"], "Summer": [
"Spain", "Portugal"], "Spring": ["France", "Italy"], "Autumn": ["Belgium", "Austria"]}
diccPresupuesto = {"Winter": 100, "Summer": 400, "Spring": 300, "Autumn": 200}
presupuesto = ["Winter", "Autumn", "Spring", "Summer"]
diccPaises = {"Andorra": "skiing activities", "Switzerland": "tour of the Swiss Alps", "Spain": "hiking and extreme sports activities", "Portugal": "activities on the beaches",
"France": "extreme sports activities", "Italy": "cultural and historical tour", "Belgium": "hiking and extreme sports activities", "Austria": "cultural and historical activities"}


def menuEstaciones(opciones):
for i in range(opciones):
print("\n", i+1, ". ", presupuesto[i])
res = input("\ningrese estacion deseada: ")
return int(res)-1


def menuDestinos(dest):
print("Los destinos posibles son ")
estacion = presupuesto[dest]
destinos = diccEstaciones[estacion]

for destino in destinos:
print("\n", destino)
pais = input("\nopcion elegida: (1 o 2) ")
return pais


def sugerencias(estacion, pais):
season = presupuesto[estacion]
country = diccEstaciones[season][pais]
print("\nEn ", season, " le sugerimos ", country)
print("\nAlli puede realizar ", diccPaises[country])


bud = int(input("\n Cuanto es el presupuesto? "))
if bud < 100:
print("No hay opciones por ese monto")
else:
if bud < 200:
est = menuEstaciones(1)
elif bud < 300:
est = menuEstaciones(2)
elif bud < 400:
est = menuEstaciones(3)
else:
est = menuEstaciones(4)

pais = menuDestinos(int(est))

sugerencias(int(est),int(pais)-1)

print("\nLe deseamos buen viaje\n\n")
59 changes: 59 additions & 0 deletions ejercicio3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""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."""

from modulos import *

def chequearBloque(opcion, doctor, bloque, hora):
doc=diccDoctors[especialidades[opcion]][doctor]
turno=diccSchedule[doc][bloque][hora]
return turno==0

diccUsers = {"Mena": "1234"}
diccDoctors = {"General Medicine":["Romero", "Figal", "Rojo"], "Emergency Care":[], "Clinical Analysis":[], "Cardiology":[],
"Neurology":[], "Nutrition":[], "Physiotherapy":[], "Traumatology":["Advincula", "Blondel", "Cavani"], "Internal Medicine":[]}
diccSchedule = {"Romero":[[1,1,1,1],[0,0,0,0]], "Figal":[[0,0,0,0],[1,1,1,1]], "Rojo":[[0,0,1,1],[1,0,1,0]]}
especialidades=["General Medicine", "Emergency Care", "Clinical Analysis", "Cardiology", "Neurology", "Nutrition", "Physiotherapy", "Traumatology", "Internal Medicine"]
turnos=["maniana", "tarde"]
horarios=[["9 hs", "10 hs", "11 hs", "12 hs"],["15 hs", "16 hs", "17 hs", "18 hs"]]
diccTurnosPaciente=dict.fromkeys(diccUsers.keys(),[3])

paciente=login(diccUsers)
opcion=crearMenu(especialidades)
while opcion!=len(especialidades):
doctor=crearMenu(diccDoctors[especialidades[opcion]])
docName = diccDoctors[especialidades[opcion]][doctor]
if doctor==len(diccDoctors[especialidades[opcion]]):
opcion=crearMenu(especialidades)
else:
bloque=crearMenu(turnos)
if bloque==len(turnos):
opcion = crearMenu(especialidades)
else:
hora=crearMenu(horarios[bloque])
if hora==len(horarios[bloque]):
opcion = crearMenu(especialidades)
else:
if chequearBloque(opcion, doctor, bloque, hora):
if diccTurnosPaciente[paciente][0]>0:
if docName not in diccTurnosPaciente[paciente]:
diccTurnosPaciente[paciente][0] = diccTurnosPaciente[paciente][0]-1
diccTurnosPaciente[paciente].append(docName)
print("\nTurno Guardado correctamente")
else:
print("\nYa tiene un turno con ese medico")
else:
print("Ya no puede tomar mas turnos por hoy")
else:
print("Horario no disponible")
opcion=crearMenu(especialidades)

salida(1)
38 changes: 38 additions & 0 deletions modulos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
def login(users):
auth = 0
oportunidades = 3
while (auth == 0 and oportunidades > 0):
name = input("Ingrese su usuario: ")
clave = input("Ingrese su contrasenia: ")
if clave == users.get(name):
auth = 1
print(" ")
print("Usuario logueado correctamente")
print(" ")
else:
print(" ")
print("Clave Incorrecta")
print(" ")
oportunidades = oportunidades-1
if oportunidades == 0:
salida(0)
return name


def salida(motivo): #0 Login Incorrecto, #1 Salida Voluntaria
if motivo == 0:
print("\nNo es posible loguearlo.")
exit()
return

def crearMenu(lista):

for i in range(len(lista)):
print("\n",i,". ", lista[i])
print("\n", len(lista), " Volver")
try:
opcion = int(input("\nElija la opcion deseada: "))
except ValueError:
print("\nPor favor, ingrese un valor numérico.")
opcion= crearMenu(lista)
return opcion