From 92fa21b6dee3fcd7ca75d677c821c67c146c1c99 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:49:31 +0100 Subject: [PATCH 01/55] Update README.md --- exercises/017-total_cost/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/017-total_cost/README.md b/exercises/017-total_cost/README.md index b3d00b6c..4faa36e5 100644 --- a/exercises/017-total_cost/README.md +++ b/exercises/017-total_cost/README.md @@ -4,18 +4,20 @@ 1. A cupcake costs `D` dollars and `C` cents. Write a function that determines how many dollars and cents should someone pay for `N` cupcakes. *The function gets three numbers: `D`, `C`, `N` and it should return two numbers: total cost in dollars and cents.* -## Example input: +## 📎 Example input: ```py total_cost(10,15,2) ``` -## Example output: +## 📎 Example output: -+ (20, 30) +```py +(20, 30) +``` ## 💡 Hints: -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/integer_float_numbers/ ++ If you don't know how to start solving this assignment, please review the theory for this lesson: https://snakify.org/lessons/integer_float_numbers/ + You may also try step-by-step theory chunks: https://snakify.org/lessons/integer_float_numbers/steps/1/ From 3d6e983d890523117c69cf7ce46b53afdce9623b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:56:05 +0100 Subject: [PATCH 02/55] Update README.md --- exercises/017-total_cost/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/017-total_cost/README.md b/exercises/017-total_cost/README.md index 4faa36e5..7ed7cb96 100644 --- a/exercises/017-total_cost/README.md +++ b/exercises/017-total_cost/README.md @@ -2,7 +2,7 @@ ## 📝 Instructions: -1. A cupcake costs `D` dollars and `C` cents. Write a function that determines how many dollars and cents should someone pay for `N` cupcakes. *The function gets three numbers: `D`, `C`, `N` and it should return two numbers: total cost in dollars and cents.* +1. A cupcake costs `D` dollars and `C` cents. Write a function that determines how many dollars and cents someone should pay for `N` cupcakes. *The function gets three numbers: `D`, `C`, `N` and it should return two numbers: total cost in dollars and cents.* ## 📎 Example input: From 5cf63c0b5602261d6841f08ab31f7784075b31c9 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:58:23 +0100 Subject: [PATCH 03/55] Update README.es.md --- exercises/017-total_cost/README.es.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/exercises/017-total_cost/README.es.md b/exercises/017-total_cost/README.es.md index c130a7b4..08dc4819 100644 --- a/exercises/017-total_cost/README.es.md +++ b/exercises/017-total_cost/README.es.md @@ -2,20 +2,22 @@ ## 📝 Instrucciones: -1. Un cupcake (quequito) cuesta `D` dólares y `C` centavos. Escribe un función `total_cost()` para determinar cuántos dólares y centavos debería pagar una persona por `N` cupcakes. *La función recibe tres números: `D`, `C`, `N` y debería devolver dos números: costo total en dólares y los centavos* +1. Un cupcake cuesta `D` dólares y `C` centavos. Escribe una función `total_cost()` para determinar cuántos dólares y centavos debería pagar una persona por `N` cupcakes. *La función recibe tres números: `D`, `C`, `N` y debería devolver dos números: costo total en dólares y centavos* -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py total_cost(10,15,2) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: -+ (20, 30) +```py +(20, 30) +``` ## 💡 Pistas: + Si no sabes por donde comenzar este ejercicio, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/integer_float_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/integer_float_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/integer_float_numbers/steps/1/ From 36a59bec4a23d41a98611e2daa672b0e27d66081 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:47:10 +0100 Subject: [PATCH 04/55] Update app.py --- exercises/017-total_cost/app.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/exercises/017-total_cost/app.py b/exercises/017-total_cost/app.py index acf6a4b1..0a04c93d 100644 --- a/exercises/017-total_cost/app.py +++ b/exercises/017-total_cost/app.py @@ -1,10 +1,7 @@ -#Complete the function to return the total cost in dollars and cents of N cupcakes. -#Remember you can return multiple parameters => return a, b -def total_cost(d,c,n): +# Complete the function to return the total cost in dollars and cents of N cupcakes +def total_cost(D,C,N): return None - - -#Invoke the function with three intergers: cost(dollars and cents) & number of cupcakes. +# Invoke the function with three integers: total_cost(dollars, cents, number of cupcakes) print(total_cost()) From 956415cb217a5920c588fb7a7e4178d079796285 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:54:00 +0100 Subject: [PATCH 05/55] Update solution.hide.py --- exercises/017-total_cost/solution.hide.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/exercises/017-total_cost/solution.hide.py b/exercises/017-total_cost/solution.hide.py index 48763f08..015d8a40 100644 --- a/exercises/017-total_cost/solution.hide.py +++ b/exercises/017-total_cost/solution.hide.py @@ -1,10 +1,7 @@ -#Complete the function to return the total cost in dollars and cents of N cupcakes. -#Remember you can return multiple parameters => return a, b +# Complete the function to return the total cost in dollars and cents of (n) cupcakes def total_cost(d,c,n): - return ((((d*100)+c)*n)//100, (((d*100)+c)*n)%100) - + return ((((c*100)+c)*n)//100, (((d*100)+c)*n)%100) - -#Invoke the function with three intergers: cost(dollars and cents) & number of cupcakes. +# Invoke the function with three integers: total_cost(dollars, cents, number of cupcakes) print(total_cost(15,22,4)) From d54fd70d9d99d7fac62cc2d66fc532fb4e3e94db Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:57:05 +0100 Subject: [PATCH 06/55] Update solution.hide.py --- exercises/017-total_cost/solution.hide.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exercises/017-total_cost/solution.hide.py b/exercises/017-total_cost/solution.hide.py index 015d8a40..5a4a31c9 100644 --- a/exercises/017-total_cost/solution.hide.py +++ b/exercises/017-total_cost/solution.hide.py @@ -1,6 +1,9 @@ # Complete the function to return the total cost in dollars and cents of (n) cupcakes -def total_cost(d,c,n): - return ((((c*100)+c)*n)//100, (((d*100)+c)*n)%100) +def total_cost(d, c, n): + total_cents = (d * 100 + c) * n + total_dollars = total_cents // 100 + remaining_cents = total_cents % 100 + return total_dollars, remaining_cents # Invoke the function with three integers: total_cost(dollars, cents, number of cupcakes) From 2876b1d045c13f3c1bf49a3702442087df026111 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:58:20 +0100 Subject: [PATCH 07/55] Update solution.hide.py --- exercises/017-total_cost/solution.hide.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/017-total_cost/solution.hide.py b/exercises/017-total_cost/solution.hide.py index 5a4a31c9..dc6c33cf 100644 --- a/exercises/017-total_cost/solution.hide.py +++ b/exercises/017-total_cost/solution.hide.py @@ -6,5 +6,5 @@ def total_cost(d, c, n): return total_dollars, remaining_cents -# Invoke the function with three integers: total_cost(dollars, cents, number of cupcakes) +# Invoke the function with three integers: total_cost(dollars, cents, number_of_cupcakes) print(total_cost(15,22,4)) From d829bc3345345070c813b2329c0ab63e72ef1717 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:58:44 +0100 Subject: [PATCH 08/55] Update app.py --- exercises/017-total_cost/app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/017-total_cost/app.py b/exercises/017-total_cost/app.py index 0a04c93d..cc578749 100644 --- a/exercises/017-total_cost/app.py +++ b/exercises/017-total_cost/app.py @@ -1,7 +1,7 @@ -# Complete the function to return the total cost in dollars and cents of N cupcakes -def total_cost(D,C,N): +# Complete the function to return the total cost in dollars and cents of (n) cupcakes +def total_cost(d, c, n): return None -# Invoke the function with three integers: total_cost(dollars, cents, number of cupcakes) -print(total_cost()) +# Invoke the function with three integers: total_cost(dollars, cents, number_of_cupcakes) +print(total_cost(15,22,4)) From 821e65fa9bf8deac2ab8b76e0171d6573edadba6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:59:03 +0100 Subject: [PATCH 09/55] Update README.md --- exercises/017-total_cost/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/017-total_cost/README.md b/exercises/017-total_cost/README.md index 7ed7cb96..fe6f4040 100644 --- a/exercises/017-total_cost/README.md +++ b/exercises/017-total_cost/README.md @@ -2,7 +2,7 @@ ## 📝 Instructions: -1. A cupcake costs `D` dollars and `C` cents. Write a function that determines how many dollars and cents someone should pay for `N` cupcakes. *The function gets three numbers: `D`, `C`, `N` and it should return two numbers: total cost in dollars and cents.* +1. A cupcake costs `d` dollars and `c` cents. Write a function that determines how many dollars and cents someone should pay for `n` cupcakes. *The function gets three numbers: `d`, `c`, `n` and it should return two numbers: total cost in dollars and cents.* ## 📎 Example input: From 83d131c4ab2d978f1531be6ff002310e954d0dd4 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 03:59:25 +0100 Subject: [PATCH 10/55] Update README.es.md --- exercises/017-total_cost/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/017-total_cost/README.es.md b/exercises/017-total_cost/README.es.md index 08dc4819..51f4e5b5 100644 --- a/exercises/017-total_cost/README.es.md +++ b/exercises/017-total_cost/README.es.md @@ -2,7 +2,7 @@ ## 📝 Instrucciones: -1. Un cupcake cuesta `D` dólares y `C` centavos. Escribe una función `total_cost()` para determinar cuántos dólares y centavos debería pagar una persona por `N` cupcakes. *La función recibe tres números: `D`, `C`, `N` y debería devolver dos números: costo total en dólares y centavos* +1. Un cupcake cuesta `d` dólares y `c` centavos. Escribe una función `total_cost()` para determinar cuántos dólares y centavos debería pagar una persona por `n` cupcakes. *La función recibe tres números: `d`, `c`, `n` y debería devolver dos números: costo total en dólares y centavos* ## 📎 Ejemplo de entrada: From 13ad9fc8ae758857e2a42bd852fcf18ee26ca301 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:01:56 +0100 Subject: [PATCH 11/55] Update test.py --- exercises/017-total_cost/test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/017-total_cost/test.py b/exercises/017-total_cost/test.py index db7473c1..08bb7499 100644 --- a/exercises/017-total_cost/test.py +++ b/exercises/017-total_cost/test.py @@ -19,11 +19,11 @@ def test_function_return_type_parameters(capsys, app): result = app.total_cost(15, 22, 4) assert type(result[0]) == type(1) and type(result[1]) == type(1) -@pytest.mark.it('We tried to pass 15, 22, 4 as parameters and it did not return (60, 88)!') +@pytest.mark.it('We tried to pass 15, 22, 4 as parameters and it did not return (60, 88)') def test_for_file_output(capsys, app): assert app.total_cost(15, 22, 4) == (60, 88) -@pytest.mark.it('We tried to pass 10, 15, 4 as parameters and it did not return (20, 30)!') +@pytest.mark.it('We tried to pass 10, 15, 4 as parameters and it did not return (20, 30)') def test_for_file_output2(capsys, app): - assert app.total_cost(15, 22, 4) == (60, 88) + assert app.total_cost(10, 15, 4) == (40, 60) From 4062a1d0bbfdc763ee3980857554bf4b70b97456 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:03:05 +0100 Subject: [PATCH 12/55] Update test.py --- exercises/017-total_cost/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/017-total_cost/test.py b/exercises/017-total_cost/test.py index 08bb7499..ef3f1380 100644 --- a/exercises/017-total_cost/test.py +++ b/exercises/017-total_cost/test.py @@ -23,7 +23,7 @@ def test_function_return_type_parameters(capsys, app): def test_for_file_output(capsys, app): assert app.total_cost(15, 22, 4) == (60, 88) -@pytest.mark.it('We tried to pass 10, 15, 4 as parameters and it did not return (20, 30)') +@pytest.mark.it('We tried to pass 10, 15, 4 as parameters and it did not return (40, 60)') def test_for_file_output2(capsys, app): assert app.total_cost(10, 15, 4) == (40, 60) From 908c3a3e91f051f1ed6549dcf2b7ceec9cb45373 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:09:41 +0100 Subject: [PATCH 13/55] Update README.md --- exercises/018-day_of_week/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exercises/018-day_of_week/README.md b/exercises/018-day_of_week/README.md index e6efb15d..ecb9fb94 100644 --- a/exercises/018-day_of_week/README.md +++ b/exercises/018-day_of_week/README.md @@ -2,7 +2,7 @@ ## 📝 Instructions: -1. Write a function `day_of_week()`. Given an integer `K` in the range 1 to 365 is given, `day_of_week()` finds the number of day of week for K-th day of year provided that in this year January 1 was Thursday. +1. Write a function `day_of_week()`, given an integer `k` in the range 1 to 365, `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. *Days of week are numbered as:* @@ -11,18 +11,20 @@ 2 — Tuesday, ... 6 — Saturday. -## Example input: +## 📎 Example input: ```py day_of_week(1) ``` -## Example output: +## 📎 Example output: -+ 4 +```py +4 +``` ## 💡 Hints: -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/integer_float_numbers/ ++ If you don't know how to start solving this assignment, please review the theory for this lesson: https://snakify.org/lessons/integer_float_numbers/ -+ You may also try step-by-step theory chunks: https://snakify.org/lessons/integer_float_numbers/steps/1/ \ No newline at end of file ++ You may also try step-by-step theory chunks: https://snakify.org/lessons/integer_float_numbers/steps/1/ From e95216c24cda3ebbeef4943de809f0efbeb3f2ac Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:10:06 +0100 Subject: [PATCH 14/55] Update README.md --- exercises/018-day_of_week/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/README.md b/exercises/018-day_of_week/README.md index ecb9fb94..5e583063 100644 --- a/exercises/018-day_of_week/README.md +++ b/exercises/018-day_of_week/README.md @@ -2,7 +2,7 @@ ## 📝 Instructions: -1. Write a function `day_of_week()`, given an integer `k` in the range 1 to 365, `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. +1. Write a function `day_of_week()`. Given an integer `k` in the range 1 to 365, `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. *Days of week are numbered as:* From fc98facd8aad66863228573dde18b9e3e6e7ec8f Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:13:44 +0100 Subject: [PATCH 15/55] Update README.md --- exercises/018-day_of_week/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exercises/018-day_of_week/README.md b/exercises/018-day_of_week/README.md index 5e583063..b3b5a9e2 100644 --- a/exercises/018-day_of_week/README.md +++ b/exercises/018-day_of_week/README.md @@ -4,12 +4,14 @@ 1. Write a function `day_of_week()`. Given an integer `k` in the range 1 to 365, `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. -*Days of week are numbered as:* +*The days of the week are numbered as:* +```text 0 — Sunday 1 — Monday 2 — Tuesday, ... -6 — Saturday. +6 — Saturday +``` ## 📎 Example input: From 9b16096d1df764e9bfa6e0c82140c23121442b0a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:17:10 +0100 Subject: [PATCH 16/55] Update README.es.md --- exercises/018-day_of_week/README.es.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/exercises/018-day_of_week/README.es.md b/exercises/018-day_of_week/README.es.md index ee27b49b..8f056aad 100644 --- a/exercises/018-day_of_week/README.es.md +++ b/exercises/018-day_of_week/README.es.md @@ -2,27 +2,31 @@ ## 📝 Instrucciones: -1. Escribe una función `day_of_week()`. Dado un entero `K` en el rango comprendido entre [1, 365], `day_of_week()` encuentra el número del día de la semana para el k-ésimo día del año si este año el 1 de enero fue jueves. +1. Escribe una función `day_of_week()`. Dado un entero `k` en el rango comprendido entre [1, 365], `day_of_week()` encuentra el número del día de la semana para el k-ésimo día del año si este año el 1 de enero fue jueves. *Los días de la semana se enumeran así:* +```text 0 — Domingo 1 — Lunes 2 — Martes, ... -6 — Sábado. +6 — Sábado +``` -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py day_of_week(1) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: -+ 4 +```py +4 +``` ## 💡 Pistas: + Si no sabes por donde comenzar este ejercicio, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/integer_float_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/integer_float_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/integer_float_numbers/steps/1/ From 5c877918f8ebc5c49cde3794f88f80cd18aa38df Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:18:41 +0100 Subject: [PATCH 17/55] Update app.py --- exercises/018-day_of_week/app.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/exercises/018-day_of_week/app.py b/exercises/018-day_of_week/app.py index 866fcedc..d479f07c 100644 --- a/exercises/018-day_of_week/app.py +++ b/exercises/018-day_of_week/app.py @@ -1,9 +1,7 @@ -#Complete the function to return the number of day of the week for k'th day of year. +# Complete the function to return the number of day of the week for k'th day of year def day_of_week(k): - return None - -#Invoke function day_of_week with an interger between 0 and 6 (number for days of week) -print(day_of_week()) \ No newline at end of file +# Invoke function day_of_week with an integer between 0 and 6 (number for days of week) +print(day_of_week()) From 2a330b69432326a831ca15171943cba115a376b2 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:19:17 +0100 Subject: [PATCH 18/55] Update solution.hide.py --- exercises/018-day_of_week/solution.hide.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/exercises/018-day_of_week/solution.hide.py b/exercises/018-day_of_week/solution.hide.py index d08fca75..338f4c6e 100644 --- a/exercises/018-day_of_week/solution.hide.py +++ b/exercises/018-day_of_week/solution.hide.py @@ -1,9 +1,7 @@ -#Complete the function to return the number of day of the week for k'th day of year. +# Complete the function to return the number of day of the week for k'th day of year def day_of_week(k): - - return (3+k)%7 + return (3 + k) % 7 - -#Invoke function day_of_week with an interger between 0 and 6 (number for days of week) -print(day_of_week(1)) \ No newline at end of file +# Invoke function day_of_week with an integer between 0 and 6 (number for days of week) +print(day_of_week(1)) From 234463c902b2ea8b1b687ead6d1ca414971bf617 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:21:08 +0100 Subject: [PATCH 19/55] Update README.md --- exercises/018-day_of_week/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/README.md b/exercises/018-day_of_week/README.md index b3b5a9e2..8fd4713d 100644 --- a/exercises/018-day_of_week/README.md +++ b/exercises/018-day_of_week/README.md @@ -2,7 +2,7 @@ ## 📝 Instructions: -1. Write a function `day_of_week()`. Given an integer `k` in the range 1 to 365, `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. +1. Write a function `day_of_week()`. Given an integer `k` in the range [1, 365], `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. *The days of the week are numbered as:* From 35d140c8c9a0dd12e95e9617038af21a4c9d6cb6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:21:27 +0100 Subject: [PATCH 20/55] Update README.md --- exercises/018-day_of_week/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/README.md b/exercises/018-day_of_week/README.md index 8fd4713d..b3b5a9e2 100644 --- a/exercises/018-day_of_week/README.md +++ b/exercises/018-day_of_week/README.md @@ -2,7 +2,7 @@ ## 📝 Instructions: -1. Write a function `day_of_week()`. Given an integer `k` in the range [1, 365], `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. +1. Write a function `day_of_week()`. Given an integer `k` in the range 1 to 365, `day_of_week()` finds the number of day of week for *k-th* day of the year, provided that in this year January 1 was Thursday. *The days of the week are numbered as:* From 8abd13e5494efba369c1e5d49cef21bdade727ae Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:21:47 +0100 Subject: [PATCH 21/55] Update README.es.md --- exercises/018-day_of_week/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/README.es.md b/exercises/018-day_of_week/README.es.md index 8f056aad..010cbccc 100644 --- a/exercises/018-day_of_week/README.es.md +++ b/exercises/018-day_of_week/README.es.md @@ -2,7 +2,7 @@ ## 📝 Instrucciones: -1. Escribe una función `day_of_week()`. Dado un entero `k` en el rango comprendido entre [1, 365], `day_of_week()` encuentra el número del día de la semana para el k-ésimo día del año si este año el 1 de enero fue jueves. +1. Escribe una función `day_of_week()`. Dado un entero `k` en el rango comprendido entre 1 a 365, `day_of_week()` encuentra el número del día de la semana para el k-ésimo día del año si este año el 1 de enero fue jueves. *Los días de la semana se enumeran así:* From 8c8b0f35375475b6db1262278e9da4d53d2f3b47 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:22:22 +0100 Subject: [PATCH 22/55] Update test.py --- exercises/018-day_of_week/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/018-day_of_week/test.py b/exercises/018-day_of_week/test.py index 7d80c585..62a58a77 100644 --- a/exercises/018-day_of_week/test.py +++ b/exercises/018-day_of_week/test.py @@ -14,11 +14,11 @@ def test_function_return(capsys, app): def test_function_return_type(capsys, app): assert type(app.day_of_week(1)) == type(1) -@pytest.mark.it('Something went wrong! We tried to pass 1 as parameter and it did not return 4! Keep trying!') +@pytest.mark.it('Something went wrong! We tried to pass 1 as parameter and it did not return 4. Keep trying!') def test_for_file_output(capsys, app): assert app.day_of_week(1) == 4 -@pytest.mark.it('Something went wrong! We tried to pass 46 as parameter and it did not return 4! Keep trying!') +@pytest.mark.it('Something went wrong! We tried to pass 46 as parameter and it did not return 0. Keep trying!') def test_for_file_output2(capsys, app): assert app.day_of_week(46) == 0 From 50c7934e661d22f63ab8097ff87eba8c955c3e4e Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:24:46 +0100 Subject: [PATCH 23/55] Update app.py --- exercises/018-day_of_week/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/app.py b/exercises/018-day_of_week/app.py index d479f07c..110ad973 100644 --- a/exercises/018-day_of_week/app.py +++ b/exercises/018-day_of_week/app.py @@ -3,5 +3,5 @@ def day_of_week(k): return None -# Invoke function day_of_week with an integer between 0 and 6 (number for days of week) +# Invoke function day_of_week with an integer between 1 and 365 print(day_of_week()) From 9120dcc5ba2a58851adf3f3896bbb3fdb4037a52 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:24:55 +0100 Subject: [PATCH 24/55] Update solution.hide.py --- exercises/018-day_of_week/solution.hide.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/solution.hide.py b/exercises/018-day_of_week/solution.hide.py index 338f4c6e..b73d12d6 100644 --- a/exercises/018-day_of_week/solution.hide.py +++ b/exercises/018-day_of_week/solution.hide.py @@ -3,5 +3,5 @@ def day_of_week(k): return (3 + k) % 7 -# Invoke function day_of_week with an integer between 0 and 6 (number for days of week) +# Invoke function day_of_week with an integer between 1 and 365 print(day_of_week(1)) From 5fb74a7adcd951761ea7d3add6e4f5433028295a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:26:08 +0100 Subject: [PATCH 25/55] Update solution.hide.py --- exercises/018-day_of_week/solution.hide.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/018-day_of_week/solution.hide.py b/exercises/018-day_of_week/solution.hide.py index b73d12d6..c4acc7f3 100644 --- a/exercises/018-day_of_week/solution.hide.py +++ b/exercises/018-day_of_week/solution.hide.py @@ -4,4 +4,4 @@ def day_of_week(k): # Invoke function day_of_week with an integer between 1 and 365 -print(day_of_week(1)) +print(day_of_week(125)) From ca891c18d091a211a0c34ba9922e77f9b73957e7 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:31:13 +0100 Subject: [PATCH 26/55] Update README.md --- exercises/019-digital_clock/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/exercises/019-digital_clock/README.md b/exercises/019-digital_clock/README.md index 250e4def..1cc4d0a1 100644 --- a/exercises/019-digital_clock/README.md +++ b/exercises/019-digital_clock/README.md @@ -2,22 +2,24 @@ ## 📝 Instructions: -1. Given the integer `N` - the number of minutes that is passed since midnight. How many hours and minutes are displayed on the 24h digital clock? Write a `digital_clock()` function to calculate it. *The function should print two numbers: the number of hours (between 0 and 23) and the number of minutes (between 0 and 59).* +1. Given the integer `n` - the number of minutes that have passed since midnight, how many hours and minutes are displayed on the 24h digital clock? Write a `digital_clock()` function to calculate it. *The function should print two numbers: the number of hours (between 0 and 23) and the number of minutes (between 0 and 59).* -## Example input: +## 📎 Example input: ```py digital_clock(150) ``` -## Example output: +## 📎 Example output: -+ (2, 30) +```py +(2, 30) +``` -For example, if N = 150, then 150 minutes have passed since midnight - i.e. now is 2:30 am. So the function should print 2 30. +For example, if n = 150, then 150 minutes have passed since midnight - i.e. now is 2:30 am. So the function should print 2, 30. ## 💡 Hints: -+ If you don't know how to start solving this assignment, please, review a theory for this lesson: https://snakify.org/lessons/integer_float_numbers/ ++ If you don't know how to start solving this assignment, please review the theory for this lesson: https://snakify.org/lessons/integer_float_numbers/ -+ You may also try step-by-step theory chunks: https://snakify.org/lessons/integer_float_numbers/steps/1/ \ No newline at end of file ++ You may also try step-by-step theory chunks: https://snakify.org/lessons/integer_float_numbers/steps/1/ From 2e267444c9395ee211dcbe66ceae96be3998d2f7 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:39:04 +0100 Subject: [PATCH 27/55] Update README.es.md --- exercises/019-digital_clock/README.es.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/exercises/019-digital_clock/README.es.md b/exercises/019-digital_clock/README.es.md index a42383bc..9355f5c9 100644 --- a/exercises/019-digital_clock/README.es.md +++ b/exercises/019-digital_clock/README.es.md @@ -2,22 +2,24 @@ ## 📝 Instrucciones: -1. Dado un entero `N` que representa el número de minutos han pasado desde media noche, ¿cuántas horas y minutos se han mostrado en un reloj digital con formato 24 horas? Escribe una función `digital_clock()` para calcularlo. *La función debería imprimir dos números: el número de horas (entre 0 y 23) y el número de minutos (entre 0 y 59).* +1. Dado un entero `n` que representa el número de minutos que han pasado desde media noche, ¿cuántas horas y minutos se mostrarían en un reloj digital con formato 24 horas? Escribe una función `digital_clock()` para calcularlo. *La función debería imprimir dos números: el número de horas (entre 0 y 23) y el número de minutos (entre 0 y 59).* -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py digital_clock(150) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: -+ (2, 30) +```py +(2, 30) +``` -Por ejemplo, si N = 150, entonces son 150 minutos que han pasado desde medianoche. Es decir, ahora son las 2:30 am, así que la función debería imprimir 2 30. +Por ejemplo, si n = 150, entonces son 150 minutos que han pasado desde medianoche. Es decir, ahora son las 2:30 am, así que la función debería imprimir (2, 30). ## 💡 Pistas: + Si no sabes por donde comenzar este ejercicio, por favor, revisa la teoría en esta lección: https://snakify.org/lessons/integer_float_numbers/ -+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/integer_float_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/integer_float_numbers/steps/1/ From a086e8c22109a5686eebf00b2eb41915943a60cb Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:41:00 +0100 Subject: [PATCH 28/55] Update app.py --- exercises/019-digital_clock/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/019-digital_clock/app.py b/exercises/019-digital_clock/app.py index 8f9652f7..1862864d 100644 --- a/exercises/019-digital_clock/app.py +++ b/exercises/019-digital_clock/app.py @@ -1,6 +1,6 @@ -#Complete the function to return how many hrs and min are displayed on the 24th digital clock. +# Complete the function to return how many hours and minutes are displayed on the 24h digital clock def digital_clock(n): return None -#Invoke the function with any interger (seconds after midnight) +# Invoke the function with any integer (minutes after midnight) print(digital_clock()) From 4e9319cfd5e52197fc47a1bbe7ad2b8df153b1d0 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:41:30 +0100 Subject: [PATCH 29/55] Update solution.hide.py --- exercises/019-digital_clock/solution.hide.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/019-digital_clock/solution.hide.py b/exercises/019-digital_clock/solution.hide.py index 997971b3..8125f691 100644 --- a/exercises/019-digital_clock/solution.hide.py +++ b/exercises/019-digital_clock/solution.hide.py @@ -1,6 +1,6 @@ -#Complete the function to return how many hrs and min are displayed on the 24th digital clock. +# Complete the function to return how many hours and minutes are displayed on the 24h digital clock def digital_clock(n): return ((n // 60), (n % 60)) -#Invoke the function with any interger (seconds after midnight) +# Invoke the function with any integer (minutes after midnight) print(digital_clock(150)) From cb5b4c44f004058a7da1a369112a3a8a7ea677fb Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:43:44 +0100 Subject: [PATCH 30/55] Update test.py --- exercises/019-digital_clock/test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/019-digital_clock/test.py b/exercises/019-digital_clock/test.py index a673e878..71e2f078 100644 --- a/exercises/019-digital_clock/test.py +++ b/exercises/019-digital_clock/test.py @@ -14,11 +14,11 @@ def test_function_return(capsys, app): def test_function_return_type(capsys, app): assert type(app.digital_clock(194)) == type((3, 14)) -@pytest.mark.it('We tried to pass 194 as parameter and it did not return (3, 14)!Keep Trying!') +@pytest.mark.it('We tried to pass 194 as parameter and it did not return (3, 14). Keep Trying!') def test_for_file_output(capsys, app): assert app.digital_clock(194) == (3, 14) -@pytest.mark.it('We tried to pass 150 as parameter and it did not return (2, 50)! Keep Trying!') +@pytest.mark.it('We tried to pass 150 as parameter and it did not return (2, 30). Keep Trying!') def test_for_file_output(capsys, app): - assert app.digital_clock(150) == (2,30) + assert app.digital_clock(150) == (2, 30) From 08aa679017656f7d734282b626dacf84f44221c6 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:44:16 +0100 Subject: [PATCH 31/55] Update README.md --- exercises/019-digital_clock/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/019-digital_clock/README.md b/exercises/019-digital_clock/README.md index 1cc4d0a1..dc1b2f25 100644 --- a/exercises/019-digital_clock/README.md +++ b/exercises/019-digital_clock/README.md @@ -16,7 +16,7 @@ digital_clock(150) (2, 30) ``` -For example, if n = 150, then 150 minutes have passed since midnight - i.e. now is 2:30 am. So the function should print 2, 30. +For example, if n = 150, then 150 minutes have passed since midnight - i.e. now is 2:30 am. So the function should print (2, 30). ## 💡 Hints: From 133efc6c3f2580ab52359d46bb5e6ca07cf837b7 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:51:20 +0100 Subject: [PATCH 32/55] Update README.md --- exercises/020-factorial/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/020-factorial/README.md b/exercises/020-factorial/README.md index 932ee8b2..a835ba34 100644 --- a/exercises/020-factorial/README.md +++ b/exercises/020-factorial/README.md @@ -2,17 +2,19 @@ ## 📝 Instructions: -1. Create a function named `factorial()` which receives a number as parameter and returns the factorial of the given number. +1. Create a function named `factorial()`, which receives a number as a parameter and returns the factorial of the given number. -## Example input: +## 📎 Example input: ```py factorial(8) ``` -## Example output: +## 📎 Example output: -+ 40320 +```py +40320 +``` ## 💡 Hint: From 18f9426240a050cec2fe31e5693273a4b5ec49c0 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:52:57 +0100 Subject: [PATCH 33/55] Update README.es.md --- exercises/020-factorial/README.es.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/020-factorial/README.es.md b/exercises/020-factorial/README.es.md index 058652bb..e6501d90 100644 --- a/exercises/020-factorial/README.es.md +++ b/exercises/020-factorial/README.es.md @@ -2,17 +2,19 @@ ## 📝 Instrucciones: -1. Crea una función llamada `factorial()` que al recibir un número como parámatro retorne su valor factorial. +1. Crea una función llamada `factorial()`, que al recibir un número como parámetro retorne su valor factorial. -## Ejemplo de entrada: +## 📎 Ejemplo de entrada: ```py factorial(8) ``` -## Ejemplo de salida: +## 📎 Ejemplo de salida: -+ 40320 +```py +40320 +``` ## 💡 Pista: From f63d74b87a92f8936fa0f1f4130cd180aba4ae5a Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 04:58:44 +0100 Subject: [PATCH 34/55] Update solution.hide.py --- exercises/020-factorial/solution.hide.py | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/exercises/020-factorial/solution.hide.py b/exercises/020-factorial/solution.hide.py index 0a188d3b..32326304 100644 --- a/exercises/020-factorial/solution.hide.py +++ b/exercises/020-factorial/solution.hide.py @@ -1,17 +1,17 @@ -def fact(x): - if x == 0: - return 1 - return x * fact(x - 1) - -x=int(input()) -print (fact(x)) - +# Your code here +def factorial(x): + result = 1 + for i in range(1, x + 1): + result *= i + return result -# or +print(factorial(5)) -# Your code here -import math -def factorial(num): - return math.factorial(num) +### Solution 2 ### -print(factorial(8)) \ No newline at end of file +# import math +# +# def factorial(x): +# return math.factorial(x) +# +# print(factorial(8)) From b6be5f92ce33eb8570e0db1e2ea2cb202f33e33d Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:01:47 +0100 Subject: [PATCH 35/55] Update test.py --- exercises/020-factorial/test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/020-factorial/test.py b/exercises/020-factorial/test.py index 04c23a6c..8360a6f1 100644 --- a/exercises/020-factorial/test.py +++ b/exercises/020-factorial/test.py @@ -13,7 +13,7 @@ def test_factorial_exists(app): def test_function_return(capsys, app): assert app.factorial(8) != None -@pytest.mark.it('The function must return a tuple') +@pytest.mark.it('The function must return a number') def test_function_return_type(capsys, app): assert type(app.factorial(8)) == type(1) @@ -36,4 +36,5 @@ def test_factorial_1(app): try: assert app.factorial(1) == 1 except AttributeError: - raise AttributeError("The function 'factorial' should return the value 1") \ No newline at end of file + raise AttributeError("The function 'factorial' should return the value 1") + From 77bb109fb2ca39b826b49261b9cb1029db65e05f Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:35:49 +0100 Subject: [PATCH 36/55] Update README.md --- exercises/22-Integral/README.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/exercises/22-Integral/README.md b/exercises/22-Integral/README.md index 515fbf6a..37d0fca4 100644 --- a/exercises/22-Integral/README.md +++ b/exercises/22-Integral/README.md @@ -1,11 +1,19 @@ -# `22` Integral +# `22` squares dictionary -With a given integral number n, write a program to generate a dictionary that contains (i, i*i) such that is an integral number between 1 and n (both included). Then the program should print the dictionary. -Suppose the following input is supplied to the program: +## 📝 Instructions: + +1. Create a function called `squares_dictionary()`. The function receives a number `n` and should generate a dictionary that contains pairs of the form `(n: n*n)` for each number in the range from 1 to n, inclusive. + +2. Print the resulting dictionary. + +## 📎 Example input: + +```py 8 -Then, the output should be: -{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} +``` + +## 📎 Example output: -Hints: -In case of input data being supplied to the question, it should be assumed to be a console input. -Consider use dict() \ No newline at end of file +```py +{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} +``` From 1f0cf7a42baee24d0e35a97a1238d650d97a384c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:39:15 +0100 Subject: [PATCH 37/55] Update README.md --- exercises/22-Integral/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/22-Integral/README.md b/exercises/22-Integral/README.md index 37d0fca4..5b4507a2 100644 --- a/exercises/22-Integral/README.md +++ b/exercises/22-Integral/README.md @@ -9,7 +9,7 @@ ## 📎 Example input: ```py -8 +squares_dictionary(8) ``` ## 📎 Example output: From 9b859b42aff3f08c91c16f2b4c3d3a2e980bb426 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:41:35 +0100 Subject: [PATCH 38/55] Update README.es.md --- exercises/22-Integral/README.es.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/exercises/22-Integral/README.es.md b/exercises/22-Integral/README.es.md index 5172b806..b088a0e2 100644 --- a/exercises/22-Integral/README.es.md +++ b/exercises/22-Integral/README.es.md @@ -1,11 +1,19 @@ -# `22` Integral +# `22` squares dictionary -Dado un número integral n, escribe un programa para generar un diccionario que contenga (i, i*i) como un número integrak entre 1 y n (ambos incluidos). Luego el programa debiese imprimir el diccionario. -Supongamos que se le entrega la siguiente entrada al programa: -8 -El resultado debiese ser: -{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} +## 📝 Instrucciones: + +1. Crea una función llamada `squares_dictionary()`. La función recibe un número `n` y debería generar un diccionario que contenga pares de la forma `(n: n*n)` para cada número en el rango de 1 a n, inclusive. + +2. Imprime el diccionario resultante. + +## 📎 Ejemplo de entrada: -Pistas: -En el caso de que se le entreguen datos a la pregunta, deben asumirse como entradas de la consola. -Considera usar dict() +```py +squares_dictionary(8) +``` + +## 📎 Ejemplo de salida: + +```py +{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} +``` From 475fc38f645e4e03030871c68c3b4554cd08f13c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:41:52 +0100 Subject: [PATCH 39/55] Update app.py --- exercises/22-Integral/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/22-Integral/app.py b/exercises/22-Integral/app.py index e69de29b..a51f0856 100644 --- a/exercises/22-Integral/app.py +++ b/exercises/22-Integral/app.py @@ -0,0 +1 @@ +# Your code here From ad470960ae94922f6da4abf1dfdd2086e04d0976 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:47:30 +0100 Subject: [PATCH 40/55] Update solution.hide.py --- exercises/22-Integral/solution.hide.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/exercises/22-Integral/solution.hide.py b/exercises/22-Integral/solution.hide.py index 262f2213..7d465a3a 100644 --- a/exercises/22-Integral/solution.hide.py +++ b/exercises/22-Integral/solution.hide.py @@ -1,7 +1,8 @@ -def generate_dict(n): - d=dict() - for i in range(1,n+1): - d[i]=i*i - return d +# Your code here +def squares_dictionary(n): + new_dict = dict() + for i in range(1, n + 1): + new_dict[i] = i * i + return new_dict -print(generate_dict(n)) \ No newline at end of file +print(squares_dictionary(5)) From fa43a77597564182cf7ab87226611a554645ca18 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:49:18 +0100 Subject: [PATCH 41/55] Update test.py --- exercises/22-Integral/test.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/exercises/22-Integral/test.py b/exercises/22-Integral/test.py index ee977613..61500058 100644 --- a/exercises/22-Integral/test.py +++ b/exercises/22-Integral/test.py @@ -1,19 +1,18 @@ import pytest,os,re,io,sys, mock, json -@pytest.mark.it('The function generate_dict should exist') +@pytest.mark.it('The function squares_dictionary should exist') def test_function_existence(capsys, app): - assert app.generate_dict + assert app.squares_dictionary @pytest.mark.it('The function should return a dictionary') def test_typeof_return(capsys, app): - assert type(app.generate_dict(7)) == type({}) + assert type(app.squares_dictionary(7)) == type({}) -@pytest.mark.it('The function should return the expected output') +@pytest.mark.it('The function should return the expected output. Testing with 8') def test_expected_output(capsys, app): - assert app.generate_dict(8) == {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} + assert app.squares_dictionary(8) == {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} -@pytest.mark.it('The function should work with other entries') +@pytest.mark.it('The function should return the expected output. Testing with 5') def test_another_entry_5(capsys, app): - assert app.generate_dict(5) == {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} - + assert app.squares_dictionary(5) == {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} From 2ede74502e0e949311805e4c51404798da044442 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:51:31 +0100 Subject: [PATCH 42/55] Update README.es.md --- exercises/22-Integral/README.es.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/22-Integral/README.es.md b/exercises/22-Integral/README.es.md index b088a0e2..c2ba75b7 100644 --- a/exercises/22-Integral/README.es.md +++ b/exercises/22-Integral/README.es.md @@ -17,3 +17,7 @@ squares_dictionary(8) ```py {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} ``` + +## 💡 Pista: + ++ Un bucle `for` sería buena idea. From 76866fb0e3e4078cfc9d521d67ca09c0f84d7bb8 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 05:51:55 +0100 Subject: [PATCH 43/55] Update README.md --- exercises/22-Integral/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/22-Integral/README.md b/exercises/22-Integral/README.md index 5b4507a2..9d675d1a 100644 --- a/exercises/22-Integral/README.md +++ b/exercises/22-Integral/README.md @@ -17,3 +17,7 @@ squares_dictionary(8) ```py {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64} ``` + +## 💡 Hint: + ++ A `for` loop would be a good idea. From 08fd69eeec09a179972732562170f3aee84822fa Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:04:27 +0100 Subject: [PATCH 44/55] Update README.md --- exercises/23-list-and-tuple/README.md | 32 ++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/exercises/23-list-and-tuple/README.md b/exercises/23-list-and-tuple/README.md index 15cbf7b1..815e2a3d 100644 --- a/exercises/23-list-and-tuple/README.md +++ b/exercises/23-list-and-tuple/README.md @@ -1,12 +1,28 @@ -# `23` List and touple +# `23` List and tuple -Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number. -Suppose the following input is supplied to the program: -34,67,55,33,12,98 -Then, the output should be: +## 📝 Instructions: + +1. Create a function called `list_and_tuple()`, that given a input of `n` numbers returns a list and a tuple of those numbers and transforms each of them into a string. + +## 📎 Example input: + +```py +list_and_tuple(34,67,55,33,12,98) +``` + +## 📎 Example output: + +```py ['34', '67', '55', '33', '12', '98'] ('34', '67', '55', '33', '12', '98') +``` + +## 💡 Hint: + ++ The number of parameters accepted by the function is not limited. + ++ To make a function that accepts an unlimited number of arguments, use the `*` operator and then any name you want for it. For example: -Hints: -In case of input data being supplied to the question, it should be assumed to be a console input. -tuple() method can convert list to tuple \ No newline at end of file +```py +def my_function(*args) +``` From 959417c6c359b16a2f9d8a17ee45a7c4fdbf0e9e Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:07:23 +0100 Subject: [PATCH 45/55] Update README.md --- exercises/23-list-and-tuple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/23-list-and-tuple/README.md b/exercises/23-list-and-tuple/README.md index 815e2a3d..90a4a8b8 100644 --- a/exercises/23-list-and-tuple/README.md +++ b/exercises/23-list-and-tuple/README.md @@ -17,7 +17,7 @@ list_and_tuple(34,67,55,33,12,98) ('34', '67', '55', '33', '12', '98') ``` -## 💡 Hint: +## 💡 Hints: + The number of parameters accepted by the function is not limited. From 1a9c65c11fcd6b70979ab4e75c15c2d9be46f8d3 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:09:57 +0100 Subject: [PATCH 46/55] Update README.es.md --- exercises/23-list-and-tuple/README.es.md | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/exercises/23-list-and-tuple/README.es.md b/exercises/23-list-and-tuple/README.es.md index 3b9313cb..3cb40364 100644 --- a/exercises/23-list-and-tuple/README.es.md +++ b/exercises/23-list-and-tuple/README.es.md @@ -1,12 +1,28 @@ -# `23` Lista y tupla +# `23` List and tuple -Escribe un programa que acepte una secuencia de números separados por comas desde la consola y genere una lista y una tupla que contenga todos los números. -Supongamos que se le entrega la siguiente entrada al programa: -34,67,55,33,12,98 -El resultado debiese ser: +## 📝 Instrucciones: + +1. Crea una función llamada `list_and_tuple()` que, dado un conjunto de `n` números como entrada, devuelve una lista y una tupla con esos números y los transforma a cada uno de ellos en string. + +## 📎 Ejemplo de entrada: + +```py +list_and_tuple(34,67,55,33,12,98) +``` + +## 📎 Ejemplo de salida: + +```py ['34', '67', '55', '33', '12', '98'] ('34', '67', '55', '33', '12', '98') +``` + +## 💡 Pistas: + ++ La cantidad de parámetros aceptados por la función no está limitado. + ++ Para crear una función que acepta un número ilimitado de argumentos, utiliza el operador `*` y luego cualquier nombre que desees. De esta forma: -Pistas: -En el caso de que se le entreguen entradas de datos a la pregunta, deben asumirse como entradas de la consola. -Usa el método tuple() para convertir la lista en una tupla. +```py +def my_function(*args) +``` From 70f4713d3572f0380d6e59872a6ec5552bf00c0b Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:10:21 +0100 Subject: [PATCH 47/55] Update app.py --- exercises/23-list-and-tuple/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/23-list-and-tuple/app.py b/exercises/23-list-and-tuple/app.py index e69de29b..a51f0856 100644 --- a/exercises/23-list-and-tuple/app.py +++ b/exercises/23-list-and-tuple/app.py @@ -0,0 +1 @@ +# Your code here From a7e83f3df77c91e8a544f89dd890b59daafbc4ca Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:11:19 +0100 Subject: [PATCH 48/55] Update README.md --- exercises/23-list-and-tuple/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exercises/23-list-and-tuple/README.md b/exercises/23-list-and-tuple/README.md index 90a4a8b8..11d55db1 100644 --- a/exercises/23-list-and-tuple/README.md +++ b/exercises/23-list-and-tuple/README.md @@ -4,6 +4,8 @@ 1. Create a function called `list_and_tuple()`, that given a input of `n` numbers returns a list and a tuple of those numbers and transforms each of them into a string. +2. Imprime la lista y en la siguiente linea la tupla. + ## 📎 Example input: ```py From 2cd8b8d7097675fd26ae9e69b8f4b10df8599c76 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:13:02 +0100 Subject: [PATCH 49/55] Update README.es.md --- exercises/23-list-and-tuple/README.es.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exercises/23-list-and-tuple/README.es.md b/exercises/23-list-and-tuple/README.es.md index 3cb40364..af92bcb2 100644 --- a/exercises/23-list-and-tuple/README.es.md +++ b/exercises/23-list-and-tuple/README.es.md @@ -4,6 +4,8 @@ 1. Crea una función llamada `list_and_tuple()` que, dado un conjunto de `n` números como entrada, devuelve una lista y una tupla con esos números y los transforma a cada uno de ellos en string. +2. Imprime la lista y en la siguiente linea la tupla. + ## 📎 Ejemplo de entrada: ```py From 33663cf7b2cad8fc2a2da213a3b2458b8386bb3f Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:13:56 +0100 Subject: [PATCH 50/55] Update README.md --- exercises/23-list-and-tuple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/23-list-and-tuple/README.md b/exercises/23-list-and-tuple/README.md index 11d55db1..623c8080 100644 --- a/exercises/23-list-and-tuple/README.md +++ b/exercises/23-list-and-tuple/README.md @@ -4,7 +4,7 @@ 1. Create a function called `list_and_tuple()`, that given a input of `n` numbers returns a list and a tuple of those numbers and transforms each of them into a string. -2. Imprime la lista y en la siguiente linea la tupla. +2. Print the list, and in the next line, print the tuple. ## 📎 Example input: From 1d0e7042d949c6182bc6781ecbf41f947a0f10d5 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:14:38 +0100 Subject: [PATCH 51/55] Update README.es.md --- exercises/23-list-and-tuple/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/23-list-and-tuple/README.es.md b/exercises/23-list-and-tuple/README.es.md index af92bcb2..ddd8234d 100644 --- a/exercises/23-list-and-tuple/README.es.md +++ b/exercises/23-list-and-tuple/README.es.md @@ -4,7 +4,7 @@ 1. Crea una función llamada `list_and_tuple()` que, dado un conjunto de `n` números como entrada, devuelve una lista y una tupla con esos números y los transforma a cada uno de ellos en string. -2. Imprime la lista y en la siguiente linea la tupla. +2. Imprime la lista primero, y en la siguiente línea la tupla. ## 📎 Ejemplo de entrada: From 2e9fd8a52886c6bf6ae96d6f7f42a8abb7719fe8 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:17:20 +0100 Subject: [PATCH 52/55] Update solution.hide.py --- exercises/23-list-and-tuple/solution.hide.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exercises/23-list-and-tuple/solution.hide.py b/exercises/23-list-and-tuple/solution.hide.py index 8ca57f24..26fc246c 100644 --- a/exercises/23-list-and-tuple/solution.hide.py +++ b/exercises/23-list-and-tuple/solution.hide.py @@ -1,10 +1,10 @@ -values=input("") -l=values.split(",") -t=tuple(l) -print (l) -print (t) +# Your code here +def list_and_tuple(*args): + string_list = [str(num) for num in args] + string_tuple = tuple(string_list) + + return string_list, string_tuple -# -values=input("") -t=tuple(values.split(',')) -print(t) \ No newline at end of file +result_list, result_tuple = list_and_tuple(1, 2, 3, 4, 5) +print(result_list) +print(result_tuple) From 1990089250e7d78e9fb6501f16482cda1493644f Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 06:24:22 +0100 Subject: [PATCH 53/55] Update solution.hide.py --- exercises/23-list-and-tuple/solution.hide.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/exercises/23-list-and-tuple/solution.hide.py b/exercises/23-list-and-tuple/solution.hide.py index 26fc246c..6dfa8b32 100644 --- a/exercises/23-list-and-tuple/solution.hide.py +++ b/exercises/23-list-and-tuple/solution.hide.py @@ -1,10 +1,11 @@ # Your code here -def list_and_tuple(*args): - string_list = [str(num) for num in args] - string_tuple = tuple(string_list) +def list_and_tuple(*nums): + new_list = [str(num) for num in nums] + new_tuple = tuple(new_list) - return string_list, string_tuple + return new_list, new_tuple -result_list, result_tuple = list_and_tuple(1, 2, 3, 4, 5) + +result_list, result_tuple = list_and_tuple(5, 4, 13, 24, 45) print(result_list) print(result_tuple) From e5c8075c0c76978de852e6af1aebfb499908af9c Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:04:21 +0100 Subject: [PATCH 54/55] Update README.md --- exercises/22-Integral/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/22-Integral/README.md b/exercises/22-Integral/README.md index 9d675d1a..6856621f 100644 --- a/exercises/22-Integral/README.md +++ b/exercises/22-Integral/README.md @@ -1,4 +1,4 @@ -# `22` squares dictionary +# `22` Integral ## 📝 Instructions: From 5a61d9c9d028e64c71be697f24132eff77be43e2 Mon Sep 17 00:00:00 2001 From: Jose Mora <109150320+josemoracard@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:04:29 +0100 Subject: [PATCH 55/55] Update README.es.md --- exercises/22-Integral/README.es.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/22-Integral/README.es.md b/exercises/22-Integral/README.es.md index c2ba75b7..a554e3b3 100644 --- a/exercises/22-Integral/README.es.md +++ b/exercises/22-Integral/README.es.md @@ -1,4 +1,4 @@ -# `22` squares dictionary +# `22` Integral ## 📝 Instrucciones: