diff --git a/exercises/001-hello_world/app.py b/exercises/001-hello_world/app.py index 801de24b..fce62c1d 100644 --- a/exercises/001-hello_world/app.py +++ b/exercises/001-hello_world/app.py @@ -1 +1 @@ -# your code here \ No newline at end of file +# Your code here diff --git a/exercises/001-hello_world/solution.hide.py b/exercises/001-hello_world/solution.hide.py new file mode 100644 index 00000000..0ec004ea --- /dev/null +++ b/exercises/001-hello_world/solution.hide.py @@ -0,0 +1,2 @@ +# Your code here +print("Hello World") diff --git a/exercises/002-sum_of_three_numbers/README.es.md b/exercises/002-sum_of_three_numbers/README.es.md index cbff4ae3..5a46dfd9 100644 --- a/exercises/002-sum_of_three_numbers/README.es.md +++ b/exercises/002-sum_of_three_numbers/README.es.md @@ -4,7 +4,7 @@ 1. Teniendo tres números de entrada, imprime su suma. Cada número va en una línea aparte. -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py 2 @@ -12,7 +12,7 @@ 6 ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: ```py 11 diff --git a/exercises/002-sum_of_three_numbers/README.md b/exercises/002-sum_of_three_numbers/README.md index 86b03520..83eb3dee 100644 --- a/exercises/002-sum_of_three_numbers/README.md +++ b/exercises/002-sum_of_three_numbers/README.md @@ -4,7 +4,7 @@ 1. Taking 3 numbers from the input, print their sum. Every number is given on a separate line. -## Example input: +## 📎 Example input: ```py 2 @@ -12,7 +12,7 @@ 6 ``` -## Example output: +## 📎 Example output: ```py 11 diff --git a/exercises/002-sum_of_three_numbers/app.py b/exercises/002-sum_of_three_numbers/app.py index ee0bb4b6..21d0f403 100644 --- a/exercises/002-sum_of_three_numbers/app.py +++ b/exercises/002-sum_of_three_numbers/app.py @@ -1,7 +1,8 @@ # Sum all three input numbers and print on the console the result -first_number = int(input("First input")) -second_number = int(input("Second input")) -third_number = int(input("Third input")) -# print here the sum of three inputs +first_number = int(input("First input: ")) +second_number = int(input("Second input: ")) +third_number = int(input("Third input: ")) -print(first_number+second_number) \ No newline at end of file + +# Print here the sum of all three inputs +print(first_number+second_number) diff --git a/exercises/002-sum_of_three_numbers/solution.hide.py b/exercises/002-sum_of_three_numbers/solution.hide.py new file mode 100644 index 00000000..ba0bd5fa --- /dev/null +++ b/exercises/002-sum_of_three_numbers/solution.hide.py @@ -0,0 +1,8 @@ +# Sum all three input numbers and print on the console the result +first_number = int(input("First input: ")) +second_number = int(input("Second input: ")) +third_number = int(input("Third input: ")) + + +# Print here the sum of all three inputs +print(first_number+second_number+third_number) diff --git a/exercises/003-area_of_right_triangle/README.es.md b/exercises/003-area_of_right_triangle/README.es.md index 3d79f662..b297ab54 100644 --- a/exercises/003-area_of_right_triangle/README.es.md +++ b/exercises/003-area_of_right_triangle/README.es.md @@ -2,18 +2,19 @@ ## 📝 Instrucciones: -1. Completa la función `area_of_triangle()` para que que tome el largo de la base y la altura de un triángulo rectángulo e imprima su área. Cada número es dado en una línea por separado. +1. Completa la función `area_of_triangle()` para que tome el largo de la base y la altura de un triángulo rectángulo e imprima su área. -![Imagen descriptiva](http://i.imgur.com/6EkzVxA.jpg) +![triángulo rectángulo fórmula del área](http://i.imgur.com/6EkzVxA.jpg) -## Ejemplo: +## 📎 Ejemplo: ```py area_of_triangle(3,5) - print(7.5) +# Salida --> 7.5 ``` + ## 💡 Pistas: + Si no sabes por donde empezar este ejercicio, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/print_input_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file ++ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/003-area_of_right_triangle/README.md b/exercises/003-area_of_right_triangle/README.md index 0b0b2754..172539b6 100644 --- a/exercises/003-area_of_right_triangle/README.md +++ b/exercises/003-area_of_right_triangle/README.md @@ -2,18 +2,18 @@ ## 📝 Instructions: -1. Complete the `area_of_triangle()` function so that it reads the length of the base and the height of a right-angled triangle and prints the area. Every number is given on a separate line. +1. Complete the `area_of_triangle()` function so that it reads the length of the base and the height of a right-angled triangle and prints the area. -![Image description](http://i.imgur.com/6EkzVxA.jpg) +![right triangle area formula](http://i.imgur.com/6EkzVxA.jpg) -## Ejemplo: +## 📎 Example: ```py area_of_triangle(3,5) - print(7.5) +# Output --> 7.5 ``` ## 💡 Hints: -+ If you don't know how to start solving this exercise, please, review a theory for this lesson: https://snakify.org/lessons/print_input_numbers/ ++ If you don't know how to start solving this exercise, please review the theory for this lesson: https://snakify.org/lessons/print_input_numbers/ -+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file ++ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/003-area_of_right_triangle/app.py b/exercises/003-area_of_right_triangle/app.py index db54ac26..6b4bb318 100644 --- a/exercises/003-area_of_right_triangle/app.py +++ b/exercises/003-area_of_right_triangle/app.py @@ -1,6 +1,6 @@ -#Complete the function to return the area of the triangle. -def area_of_triangle(arg1, arg2): - #your code here, please remove the "None" +# Complete the function to return the area of a triangle +def area_of_triangle(base, height): + # Your code here, please remove the "None" return None # Testing your function diff --git a/exercises/003-area_of_right_triangle/solution.hide.py b/exercises/003-area_of_right_triangle/solution.hide.py index 58d34297..6ac0c57b 100644 --- a/exercises/003-area_of_right_triangle/solution.hide.py +++ b/exercises/003-area_of_right_triangle/solution.hide.py @@ -1,7 +1,7 @@ -#Complete the function to return the area of the triangle. -def area_of_triangle(arg1, arg2): - #your code here, please remove the "None" - return arg1 * arg2 / 2 +# Complete the function to return the area of a triangle +def area_of_triangle(base, height): + # Your code here, please remove the "None" + return base * height / 2 # Testing your function -print(area_of_triangle(3, 5)) \ No newline at end of file +print(area_of_triangle(3, 5)) diff --git a/exercises/004-hello_harry/README.es.md b/exercises/004-hello_harry/README.es.md index 22798332..064d4bc2 100644 --- a/exercises/004-hello_harry/README.es.md +++ b/exercises/004-hello_harry/README.es.md @@ -2,25 +2,25 @@ ## 📝 Instrucciones: -1. Completa la función `hello_name()` para que salude al usuario imprimiendo la palabra `Hello`, luego le agregue una coma, el nombre del usuario y un signo de exclamación después de él. +1. Completa la función `hello_name()` para que salude al usuario imprimiendo la palabra `Hello`, luego le agregue una coma, el nombre del usuario y un signo de exclamación después. *La salida de tu función debe coincidir estrictamente con la deseada, caracter por caracter. No debe haber ningún espacio entre el nombre y el signo de exclamación.* -## Ejemplo entrada: +## 📎 Ejemplo de entrada: ```py hello_name("Harry") ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: +```text Hello, Harry! +``` ## 💡 Pistas: -+ Puedes usar el operador '+' para concatenar dos strings de texto. Ve la lección para más detalles. ++ Puedes usar el operador `+` para concatenar dos strings de texto. Repasa la lección para más detalles. -+ Si no sabes por donde partir este ejercicio por favor, revisa la teoría en esta lección: -https://snakify.org/lessons/print_input_numbers/ ++ Si no sabes por donde empezar este ejercicio, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/print_input_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: -https://snakify.org/lessons/print_input_numbers/steps/1/ ++ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/004-hello_harry/README.md b/exercises/004-hello_harry/README.md index cb5743e7..f845855d 100644 --- a/exercises/004-hello_harry/README.md +++ b/exercises/004-hello_harry/README.md @@ -2,24 +2,26 @@ ## 📝 Instructions: -1. Complete the `hello_name()` function that greets the user by printing the word `Hello`, a comma, the name of the user and an exclamation mark after it. +1. Complete the `hello_name()` function that greets the user by printing the word `Hello`, a comma, the name of the user, and an exclamation mark after it. *Your function's output should strictly match the desired one, character by character. There shouldn't be any space between the name and the exclamation mark.* -## Example input: +## 📎 Example input: ```py hello_name("Harry") ``` -## Example output: +## 📎 Example output: +```text Hello, Harry! +``` ## 💡 Hints: -+ You can use '+' operator to concatenate two strings. See the lesson for details. ++ You can use `+` operator to concatenate two strings. review the lesson for details. -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/print_input_numbers/ ++ If you don't know how to start solving this assignment, please review the theory for this lesson: https://snakify.org/lessons/print_input_numbers/ + You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/004-hello_harry/app.py b/exercises/004-hello_harry/app.py index e2d36d22..4d3f3e24 100644 --- a/exercises/004-hello_harry/app.py +++ b/exercises/004-hello_harry/app.py @@ -1,7 +1,7 @@ -#Complete the function below to print the output per the example. +# Complete the function below to print the output as per the example def hello_name(name): - + # Your code here return None -#Invoke the function with your name as the function's argument. +# Invoke the function with your name as the function's argument print(hello_name("Bob")) diff --git a/exercises/004-hello_harry/solution.hide.py b/exercises/004-hello_harry/solution.hide.py index 8e7c0e41..63539e80 100644 --- a/exercises/004-hello_harry/solution.hide.py +++ b/exercises/004-hello_harry/solution.hide.py @@ -1,7 +1,7 @@ -#Complete the function below to print the output per the example. +# Complete the function below to print the output as per the example def hello_name(name): - + # Your code here return "Hello, "+name+"!" -#Invoke the function with your name as the function's argument. +# Invoke the function with your name as the function's argument print(hello_name("Bob")) diff --git a/exercises/005-previous_and_next/README.es.md b/exercises/005-previous_and_next/README.es.md index 8607726d..25b313eb 100644 --- a/exercises/005-previous_and_next/README.es.md +++ b/exercises/005-previous_and_next/README.es.md @@ -4,20 +4,22 @@ 1. Completa la función `previous_next()` para que lea un número entero y devuelva sus números anteriores y siguientes. -## Ejemplo: +## 📎 Ejemplo de entrada: ```py previous_next(179) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: -+ (178, 180) +```py +(178, 180) +``` ## 💡 Pistas: -+ Puedes devolver múltiples parámetros: return a, b ++ Puedes devolver múltiples parámetros: `return a, b` + Si no sabes por donde partir este ejercicio, por favor revisa la teoría en esta lección: https://snakify.org/lessons/print_input_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file ++ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/005-previous_and_next/README.md b/exercises/005-previous_and_next/README.md index e26caf6e..d96268d9 100644 --- a/exercises/005-previous_and_next/README.md +++ b/exercises/005-previous_and_next/README.md @@ -4,19 +4,22 @@ 1. Complete a function `previous_next()` that reads an integer number and returns its previous and next numbers. -## Example input: +## 📎 Example input: ```py previous_next(179) ``` -## Example output: -+ (178, 180) +## 📎 Example output: + +```py +(178, 180) +``` ## 💡 Hints: -+ You can return multiple parameters: return a, b ++ You can return multiple parameters: `return a, b` + If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/print_input_numbers/ -+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file ++ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/005-previous_and_next/app.py b/exercises/005-previous_and_next/app.py index 930240fa..d549fb0d 100644 --- a/exercises/005-previous_and_next/app.py +++ b/exercises/005-previous_and_next/app.py @@ -1,7 +1,8 @@ -#Complete the function to return the previous and next number of a given numner.". +# Complete the function to return the previous and next number of a given number def previous_next(num): + # Your code here return None -#Invoke the function with any interger at its argument. -print(previous_next(179)) \ No newline at end of file +# Invoke the function with any integer as its argument +print(previous_next(179)) diff --git a/exercises/005-previous_and_next/solution.hide.py b/exercises/005-previous_and_next/solution.hide.py index 4280c6e7..f38fad1b 100644 --- a/exercises/005-previous_and_next/solution.hide.py +++ b/exercises/005-previous_and_next/solution.hide.py @@ -1,7 +1,8 @@ -#Complete the function to return the previous and next number of a given numner.". +# Complete the function to return the previous and next number of a given number def previous_next(num): + # Your code here return (num-1, num+1) -#Invoke the function with any interger at its argument. -print(previous_next(179)) \ No newline at end of file +# Invoke the function with any integer as its argument +print(previous_next(179)) diff --git a/exercises/005-previous_and_next/test.py b/exercises/005-previous_and_next/test.py index a953748d..77bead1c 100644 --- a/exercises/005-previous_and_next/test.py +++ b/exercises/005-previous_and_next/test.py @@ -8,7 +8,7 @@ def test_for_functon_existence(capsys, app): def test_function_return(capsys, app): assert app.previous_next(6) != None -@pytest.mark.it('The function return a tuple') +@pytest.mark.it('The function should return a tuple') def test_function_return_type(capsys, app): result = app.previous_next(6) assert type(result) == type((1,2)) diff --git a/exercises/006-apple_sharing/README.es.md b/exercises/006-apple_sharing/README.es.md index 1905f10f..dcbeb594 100644 --- a/exercises/006-apple_sharing/README.es.md +++ b/exercises/006-apple_sharing/README.es.md @@ -2,24 +2,24 @@ ## 📝 Instrucciones: -1. `N` estudiantes cogen `K` manzanas y las distribuyen entre ell@s de manera uniforme. La parte restante (la indivisible) permanece en la cesta. ¿Cuántas manzanas recibirá cada estudiante? y ¿Cuántas manzanas quedarán en la cesta? *Esta función lee los números `N` y `K` y debería devolver la respuesta a ambas preguntas.* +1. `N` estudiantes cogen `K` manzanas y las distribuyen entre ellos de manera uniforme. La parte restante (indivisible) permanece en la cesta. ¿Cuántas manzanas recibirá cada estudiante? y ¿Cuántas manzanas quedarán en la cesta? *Esta función lee los números `N` y `K` y debería devolver la respuesta a ambas preguntas.* -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py apple_sharing(6, 50) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: -+ (8, 2) +```py +(8, 2) +``` ## 💡 Pistas: -+ Puedes devolver múltiples parámetros: return a, b ++ Puedes devolver múltiples parámetros: `return a, b` -+ Si no sabes por donde partir este ejercicio por favor, revisa la teoría en esta lección: -https://snakify.org/lessons/print_input_numbers/ ++ Si no sabes por donde partir este ejercicio, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/print_input_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: -https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file ++ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/006-apple_sharing/README.md b/exercises/006-apple_sharing/README.md index cbde1805..0126196b 100644 --- a/exercises/006-apple_sharing/README.md +++ b/exercises/006-apple_sharing/README.md @@ -2,25 +2,24 @@ ## 📝 Instructions: -1. `N` students take `K` apples and distribute them among each other evenly. The remaining (the indivisible) part remains in the basket. How many apples will each single student get and how many apples will remain in the basket? *The function reads the numbers `N` and `K` and it should return the two answers for the questions above.* +1. `N` students take `K` apples and distribute them among each other evenly. The remaining (indivisible) part remains in the basket. How many apples will each single student get, and how many apples will remain in the basket? *The function reads the numbers `N` and `K` and it should return the two answers for the questions above.* -## Example input: +## 📎 Example input: ```py apple_sharing(6, 50) ``` -## Example output: - -+ (8, 2) +## 📎 Example output: +```py +(8, 2) +``` ## 💡 Hints: -+ You can return multiple parameters: return a, b ++ You can return multiple parameters: `return a, b` -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: -https://snakify.org/lessons/print_input_numbers/ ++ If you don't know how to start solving this assignment, please review the theory for this lesson: https://snakify.org/lessons/print_input_numbers/ -+ You may also try step-by-step theory chunks: -https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file ++ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/006-apple_sharing/app.py b/exercises/006-apple_sharing/app.py index 6529a8a9..2c17d877 100644 --- a/exercises/006-apple_sharing/app.py +++ b/exercises/006-apple_sharing/app.py @@ -1,12 +1,6 @@ -#Complete the function to return: -#1) How many apples each single student will get. -#2) How many apples wil remain in the basket. -#Hint: You can resolve this exercise either importing the math module or without it def apple_sharing(n,k): - + # Your code here return None - -#Print the two answer per the example output. -print(apple_sharing(6,50)) \ No newline at end of file +print(apple_sharing(6,50)) diff --git a/exercises/006-apple_sharing/solution.hide.py b/exercises/006-apple_sharing/solution.hide.py index 6cccd262..8f7e1de6 100644 --- a/exercises/006-apple_sharing/solution.hide.py +++ b/exercises/006-apple_sharing/solution.hide.py @@ -1,12 +1,6 @@ -#Complete the function to return: -#1) How many apples each single student will get. -#2) How many apples wil remain in the basket. -#Hint: You can resolve this exercise either importing the math module or without it def apple_sharing(n,k): - - return (round(k/n),k%n) + # Your code here + return (round(k/n), k%n) - -#Print the two answer per the example output. -print(apple_sharing(6,50)) \ No newline at end of file +print(apple_sharing(6,50)) diff --git a/exercises/006.1-square_value_of_number/README.es.md b/exercises/006.1-square_value_of_number/README.es.md index 4555fe4b..e2f4257d 100644 --- a/exercises/006.1-square_value_of_number/README.es.md +++ b/exercises/006.1-square_value_of_number/README.es.md @@ -2,19 +2,20 @@ ## 📝 Instrucciones: -1. Escribe una función llamada `square()` que calcule el valor al cuadrado de un número +1. Escribe una función llamada `square()` que calcule el valor al cuadrado de un número. -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py square(6) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: ```py 36 ``` + ## 💡 Pista: + Usa el operador `**`. diff --git a/exercises/006.1-square_value_of_number/README.md b/exercises/006.1-square_value_of_number/README.md index 8e89d0bf..c75ea74d 100644 --- a/exercises/006.1-square_value_of_number/README.md +++ b/exercises/006.1-square_value_of_number/README.md @@ -1,16 +1,16 @@ # `006.1` square value of number -## 📝 Instructions +## 📝 Instructions: 1. Write a function called `square()` that calculates the square value of a number. -## Example input: +## 📎 Example input: ```py square(6) ``` -## Example output: +## 📎 Example output: ```py 36 @@ -18,4 +18,4 @@ square(6) ## 💡 Hint: -+ Using the `**` operator ++ Using the `**` operator. diff --git a/exercises/006.1-square_value_of_number/app.py b/exercises/006.1-square_value_of_number/app.py index 42d75244..086d1e41 100644 --- a/exercises/006.1-square_value_of_number/app.py +++ b/exercises/006.1-square_value_of_number/app.py @@ -1,5 +1,5 @@ -# your code here def square(num): + # Your code here return None -print(square(6)) \ No newline at end of file +print(square(6)) diff --git a/exercises/006.1-square_value_of_number/solution.hide.py b/exercises/006.1-square_value_of_number/solution.hide.py index 5b5ecf75..b2fc5d77 100644 --- a/exercises/006.1-square_value_of_number/solution.hide.py +++ b/exercises/006.1-square_value_of_number/solution.hide.py @@ -1,5 +1,5 @@ def square(num): + # Your code here return num ** 2 -print(square(2)) -print(square(3)) \ No newline at end of file +print(square(6)) diff --git a/exercises/006.1-square_value_of_number/test.py b/exercises/006.1-square_value_of_number/test.py index 8bb35b61..4f46fe8e 100644 --- a/exercises/006.1-square_value_of_number/test.py +++ b/exercises/006.1-square_value_of_number/test.py @@ -13,11 +13,11 @@ def test_function_return_type(capsys, app): result = app.square(6) assert type(result) == type(1) -@pytest.mark.it('The function should return the square of the given number.') +@pytest.mark.it('The function should return the square of the given number') def test_for_file_output(capsys, app): assert app.square(6) == 6*6 -@pytest.mark.it('The function should return the square of the given number. Testing with 47.') +@pytest.mark.it('The function should return the square of the given number. Testing with 47') def test_for_file_output(capsys, app): assert app.square(47) == 47*47 diff --git a/exercises/007-hours_and_minutes/README.es.md b/exercises/007-hours_and_minutes/README.es.md index 8db18b3d..dd12f1db 100644 --- a/exercises/007-hours_and_minutes/README.es.md +++ b/exercises/007-hours_and_minutes/README.es.md @@ -1,33 +1,27 @@ # `007` Hours and minutes -En este ejercicio vamos a suponer que es medianoche, queremos que con la función `hours_minutes` que hemos previsto para tí, nos digas cuánto tiempo ha pasado desde entonces con los segundos que se introduzcan como parámetro. +Queremos que con la función `hours_minutes` que hemos previsto para ti, nos digas cuánto tiempo ha pasado en horas y minutos desde entonces con los segundos que se introduzcan como parámetro. ## 📝 Instrucciones: 1. Completa la función para que retorne el resultado esperado. -2. Realiza dos calculos con los segundos que se pasan por parámetro en la función para que uno calcule la hora según los segundos que han pasado y el otro para saber los minutos `(hora , minutos)` +2. Realiza dos cálculos con los segundos que se pasan por parámetro en la función para que uno calcule la hora según los segundos que han pasado y el otro para saber los minutos `(horas, minutos)`. -## Ejemplo 1: +## 📎 Ejemplo 1: ```py output = hours_minutes(3900) -print(output) # (1, 5) +print(output) # (1, 5) ``` -## Ejemplo 2: +## 📎 Ejemplo 2: ```py output = hours_minutes(60) -print(output) # (0, 1) +print(output) # (0, 1) ``` -## 💡 Pistas: +## 💡 Pista: + Recuerda cuantos segundos hay en una hora (3600) y cuantos segundos en un minuto (60). - -+ Si no sabes cómo empezar la solución a esta asignación, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/print_input_numbers/ - -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ - -[comment]: \ No newline at end of file diff --git a/exercises/007-hours_and_minutes/README.md b/exercises/007-hours_and_minutes/README.md index c895becd..6769f961 100644 --- a/exercises/007-hours_and_minutes/README.md +++ b/exercises/007-hours_and_minutes/README.md @@ -1,34 +1,27 @@ # `007` Hours and Minutes -In this exercise we are going to suppose that it is midnight, we want that with the function `hours_minutes` that we have provided to you, you were able to tell us how much time has passed since then with the seconds that are introduced as parameter. +Complete the function `hours_minutes` to transform the given number of seconds into hours and minutes, indicating how much time has passed since then. ## 📝 Instructions: 1. Complete the function to return the expected result. -2. Perform two calculations with the seconds that are passed by parameter in the function so that one calculates the time according to the seconds that have passed and the other to know the minutes `(hour , minutes)`. +2. Perform two calculations based on the input parameter representing seconds. One calculation should determine the time elapsed in hours, while the other should indicate the time in minutes `(hours, minutes)`. -## Example 1: +## 📎 Example 1: ```py output = hours_minutes(3900) -print(output) # (1, 5) +print(output) # (1, 5) ``` -## Example 2: +## 📎 Example 2: ```py output = hours_minutes(60) -print(output) # (0, 1) +print(output) # (0, 1) ``` -## 💡 Hints: +## 💡 Hint: + Remember how many seconds there are in an hour (3600) and how many seconds in a minute (60). - -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/print_input_numbers/ - -+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ - - -[comment]: diff --git a/exercises/007-hours_and_minutes/app.py b/exercises/007-hours_and_minutes/app.py index 8954a0c8..14ce499b 100644 --- a/exercises/007-hours_and_minutes/app.py +++ b/exercises/007-hours_and_minutes/app.py @@ -1,7 +1,6 @@ -#Complete the function to calculate how many hours and minutes are passed since midnight. -def hours_minutes(secs): - +def hours_minutes(seconds): + # Your code here return None -#Invoke the funtion and pass any interger as its argument. -print(hours_minutes(3900)) \ No newline at end of file +# Invoke the function and pass any integer as its argument +print(hours_minutes(3900)) diff --git a/exercises/007-hours_and_minutes/solution.hide.py b/exercises/007-hours_and_minutes/solution.hide.py index 351f8d71..e5b96c68 100644 --- a/exercises/007-hours_and_minutes/solution.hide.py +++ b/exercises/007-hours_and_minutes/solution.hide.py @@ -1,9 +1,9 @@ -#Complete the function to calculate how many hours and minutes are passed since midnight. -def hours_minutes(secs): - minutes = secs // 60 - hours = minutes // 60 - minutes = minutes % 60 +def hours_minutes(seconds): + # Your code here + hours = seconds // 3600 + remaining_seconds = seconds % 3600 + minutes = remaining_seconds // 60 return (hours, minutes) -#Invoke the funtion and pass any interger as its argument. -print(hours_minutes(3900)) \ No newline at end of file +# Invoke the function and pass any integer as its argument +print(hours_minutes(3900)) diff --git a/exercises/008-two_timestamps/README.es.md b/exercises/008-two_timestamps/README.es.md index 009002e9..bd9ff384 100644 --- a/exercises/008-two_timestamps/README.es.md +++ b/exercises/008-two_timestamps/README.es.md @@ -4,28 +4,16 @@ 1. Dadas dos marcas de tiempo del mismo día: un número de horas, minutos y segundos para ambas marcas de tiempo. El momento de la primera marca de tiempo ocurrió antes del momento de la segunda. Calcula cuántos segundos pasaron entre ellas. -## Ejemplo de entrada #1: +## 📎 Ejemplo 1: ```py -two_timestamp(1,1,1,2,2,2) +output = two_timestamp(1,1,1,2,2,2) +print(output) # 3661 ``` -## Ejemplo de salida #1: - -+ 3661 - -## Ejemplo de entrada #2: +## 📎 Ejemplo 2: ```py -two_timestamp(1,2,30,1,3,20) +output = two_timestamp(1,2,30,1,3,20) +print(output) # 50 ``` - -## Ejemplo de salida #2: - -+ 50 - -## 💡 Pistas: - -+ Si no sabes por donde partir este ejercicio por favor, revisa la teoría en esta lección: https://snakify.org/lessons/print_input_numbers/ - -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/ \ No newline at end of file diff --git a/exercises/008-two_timestamps/README.md b/exercises/008-two_timestamps/README.md index b87af83c..51961e29 100644 --- a/exercises/008-two_timestamps/README.md +++ b/exercises/008-two_timestamps/README.md @@ -2,30 +2,18 @@ ## 📝 Instructions: -1. Given two timestamps of the same day: a number of hours, minutes and seconds for both of the timestamps. The moment of the first timestamp happened before the moment of the second one. Calculate how many seconds passed between them. +1. Given two timestamps of the same day: a number of hours, minutes and seconds for both of the timestamps. The moment of the first timestamp happened before the moment of the second one. Calculate how many seconds passed between them. -## Example input #1: +## 📎 Example 1: ```py -two_timestamp(1,1,1,2,2,2) +output = two_timestamp(1,1,1,2,2,2) +print(output) # 3661 ``` -## Example output #1: - -+ 3661 - -## Example input #2: +## 📎 Example 2: ```py -two_timestamp(1,2,30,1,3,20) +output = two_timestamp(1,2,30,1,3,20) +print(output) # 50 ``` - -## Example output #2: - -+ 50 - -## 💡 Hints: - -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/print_input_numbers/ - -+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/ diff --git a/exercises/008-two_timestamps/app.py b/exercises/008-two_timestamps/app.py index fda960cc..ab47d89d 100644 --- a/exercises/008-two_timestamps/app.py +++ b/exercises/008-two_timestamps/app.py @@ -1,8 +1,7 @@ -#Complete the funtion to compute how many seconds passed between the two timestamp. -def two_timestamp(hr1,min1,sec1,hr2,min2,sec2): - +def two_timestamp(hr1, min1, sec1, hr2, min2, sec2): + # Your code here return None -#Invoke the fuction and pass two timestamps(6 intergers) as its argument. -print(two_timestamp(1,1,1,2,2,2)) \ No newline at end of file +# Invoke the function and pass two timestamps(6 intergers) as its arguments +print(two_timestamp(1,1,1,2,2,2)) diff --git a/exercises/008-two_timestamps/solution.hide.py b/exercises/008-two_timestamps/solution.hide.py index 9c81eba9..88d833bd 100644 --- a/exercises/008-two_timestamps/solution.hide.py +++ b/exercises/008-two_timestamps/solution.hide.py @@ -1,14 +1,13 @@ -#Complete the funtion to compute how many seconds passed between the two timestamp. -def two_timestamp(hr1,min1,sec1,hr2,min2,sec2): - fisrt_hour = hr1 * 3600 +def two_timestamp(hr1, min1, sec1, hr2, min2, sec2): + # Your code here + first_hour = hr1 * 3600 first_min = min1 * 60 - final_first = fisrt_hour + first_min + sec1 + final_first = first_hour + first_min + sec1 second_hour = hr2 * 3600 second_min = min2 * 60 final_second = second_hour + second_min + sec2 return final_second - final_first - -#Invoke the fuction and pass two timestamps(6 intergers) as its argument. -print(two_timestamp(1,1,1,2,2,2)) \ No newline at end of file +# Invoke the function and pass two timestamps(6 integers) as its arguments +print(two_timestamp(1, 1, 1, 2, 2, 2))