Skip to content

Commit

Permalink
Merge branch 'main' into lara_docker
Browse files Browse the repository at this point in the history
  • Loading branch information
a10pepo authored Feb 15, 2025
2 parents aed390e + 60dba15 commit f3b9a5b
Show file tree
Hide file tree
Showing 31 changed files with 2,754 additions and 0 deletions.
Empty file.
26 changes: 26 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/DOCKER/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys

def sum_two_numbers(a, b):
return a + b

def main():
# Verifica que se hayan proporcionado exactamente dos argumentos
if len(sys.argv) != 3:
print("Error: Debes proporcionar exactamente dos números.")
print("Uso: python 1.py <número1> <número2>")
sys.exit(1)

try:
# Convierte los argumentos a números enteros
num1 = int(sys.argv[1])
num2 = int(sys.argv[2])

# Calcula la suma
result = sum_two_numbers(num1, num2)
print(f"La suma de {num1} y {num2} es: {result}")
except ValueError:
print("Error: Ambos argumentos deben ser números enteros válidos.")
sys.exit(1)

if __name__ == "__main__":
main()
7 changes: 7 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/DOCKER/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:latest

WORKDIR /app

COPY 1.py .

ENTRYPOINT ["python", "1.py"]
Binary file added ALUMNOS/MIA/CARLOS_PORTILLA/DOCKER/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/1/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hola Mundo")
3 changes: 3 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/1/2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nombre = "UE"

print(f"¡Hola, {nombre}")
9 changes: 9 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/2/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
print("¡Hola! ¿Cuánto quieres invertir?")
a = float(input("Invertirás"))
print(f"Invertirás {a} €")
print("Cual es el interés anual?")
b = float(input("El interés anual es"))
print(f"{b}")
c = int(input("Cuantos años quieres mantener la inversión?"))
print(f"Mantendrás la inversión de {a} con el interés {b} {c} años")
print(f"Tras esos años tendrás una cantidad de {a*b*c}")
32 changes: 32 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/3/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
def continuar():
prueba = input("Pulsa '1' para seguir o 'X' para salir: ")
if prueba == "1":
return True
elif prueba.lower() == "x":
print("Gracias por usar la aplicación.")
exit()
else:
print("Opción no válida.")
return continuar()

d = input("Hola! Pulsa '1' para entrar o 'X' para salir: ")
if d.lower() == "x":
print("Gracias por usar la aplicación.")
exit()
if d == "1":
print("¡Hola! ¿Cuánto quieres invertir? o pulsa 'X' para salir de la calculadora")
if continuar():
a = float(input("Invertirás: "))
print(f"Invertirás {a} €")
print("¿Cuál es el interés anual? o pulsa 'X' para salir de la calculadora")
if continuar():
b = float(input("El interés anual es: "))
print(f"El interés anual es {b}")
print("¿Cuántos años quieres mantener la inversión? o pulsa 'X' para salir de la calculadora")
if continuar():
c = int(input("¿Cuántos años?: "))
print(f"Mantendrás la inversión de {a}€ con un interés anual de {b} durante {c} años")
dinero_final = a * b**c
print(f"Tras esos {c} años, tendrás una cantidad de {dinero_final} €")
else:
print("Opción no válida.")
17 changes: 17 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/3/2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
numero = range(1, 101)
numeros_primos = []

for numerin in numero:
es_primo = True
if numerin < 2:
es_primo = False
else:
for i in range(2, numerin):
if numerin % i == 0:
es_primo = False
break

if es_primo:
numeros_primos.append(numerin)

print(numeros_primos)
5 changes: 5 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/3/3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
año = int(input("Dame un año"))
if año % 4 == 0:
print("Año bisiesto")
else:
print("Año no bisiesto")
48 changes: 48 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/4/1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# PARTE 1
def lista_primos():
numeros = input("Dame una lista de números separados por comas: ").replace(" ", "").split(",")
lista = []
for num in numeros:
lista.append(int(num))

numeros_primos = []
for num in lista:
es_primo = True
if num < 2:
es_primo = False
else:
for i in range(2, num):
if num % i == 0:
es_primo = False
break
if es_primo:
numeros_primos.append(num)
print(sorted(numeros_primos))

lista_primos()

# PARTE 2
def es_primo(num:int):
if num < 2:
return False
for i in range(2, num):
if num % i == 0:
return False
return True

numero = int(input("Dame un número: "))
if es_primo(numero):
print(f"{numero} es un número primo")
else:
print(f"{numero} no es un número primo")

# PARTE 3
def year():
anyo = int(input("Dime un año: "))
if anyo % 4 == 0:
return True
else:
return False

resultado = year()
print(resultado)
10 changes: 10 additions & 0 deletions ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/4/3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import requests
r = requests.get("https://randomuser.me/api")
data = r.json()
resultados = data['results']
for i in resultados:
ie = i
monsieur = ie["name"]["title"]
nombre = ie["name"]["first"]
apellido = ie["name"]["last"]
print(f"{monsieur} {nombre} {apellido}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy
pandas
requests
Loading

0 comments on commit f3b9a5b

Please sign in to comment.