-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into lara_docker
- Loading branch information
Showing
31 changed files
with
2,754 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print("Hola Mundo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nombre = "UE" | ||
|
||
print(f"¡Hola, {nombre}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") |
3 changes: 3 additions & 0 deletions
3
ALUMNOS/MIA/CARLOS_PORTILLA/PYTHON/4/ejercicio 4 venv/requirements.txt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
numpy | ||
pandas | ||
requests |
Oops, something went wrong.