Skip to content

exercises 003-sum_of_three_numbers to 008-two_timestamps #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2f3eb64
Update app.py
josemoracard Dec 12, 2023
bece101
Create solution.hide.py
josemoracard Dec 12, 2023
7b30dba
Update README.md
josemoracard Dec 12, 2023
2b696cb
Update README.es.md
josemoracard Dec 12, 2023
702c32d
Update app.py
josemoracard Dec 12, 2023
61efcd0
Create solution.hide.py
josemoracard Dec 12, 2023
9b243de
Update app.py
josemoracard Dec 12, 2023
c0e4782
Update README.md
josemoracard Dec 12, 2023
9eb34d2
Update README.md
josemoracard Dec 12, 2023
6ebb516
Update README.es.md
josemoracard Dec 12, 2023
cfcfdb8
Update solution.hide.py
josemoracard Dec 12, 2023
6cb2933
Update app.py
josemoracard Dec 12, 2023
192b200
Update README.md
josemoracard Dec 12, 2023
285155b
Update README.md
josemoracard Dec 12, 2023
abc3907
Update README.es.md
josemoracard Dec 12, 2023
4eaf160
Update app.py
josemoracard Dec 12, 2023
e18e11c
Update solution.hide.py
josemoracard Dec 12, 2023
229e685
Update README.es.md
josemoracard Dec 12, 2023
20f7431
Update README.md
josemoracard Dec 12, 2023
cf52281
Update README.es.md
josemoracard Dec 12, 2023
62f2812
Update README.md
josemoracard Dec 12, 2023
594cd5b
Update README.es.md
josemoracard Dec 12, 2023
348d11f
Update README.es.md
josemoracard Dec 12, 2023
48aaf28
Update app.py
josemoracard Dec 12, 2023
fe35e42
Update app.py
josemoracard Dec 12, 2023
38d1175
Update solution.hide.py
josemoracard Dec 12, 2023
517cfba
Update solution.hide.py
josemoracard Dec 12, 2023
17781d2
Update README.md
josemoracard Dec 12, 2023
6f92525
Update README.es.md
josemoracard Dec 12, 2023
8ce46ca
Update test.py
josemoracard Dec 12, 2023
9524070
Update app.py
josemoracard Dec 12, 2023
065219c
Update solution.hide.py
josemoracard Dec 12, 2023
7baaa30
Update README.md
josemoracard Dec 12, 2023
f5dff57
Update README.md
josemoracard Dec 12, 2023
63d8a5c
Update README.es.md
josemoracard Dec 12, 2023
e24a5f8
Update README.es.md
josemoracard Dec 12, 2023
e631673
Update app.py
josemoracard Dec 12, 2023
f8471ab
Update solution.hide.py
josemoracard Dec 12, 2023
09c4af5
Update solution.hide.py
josemoracard Dec 12, 2023
9a84243
Update README.md
josemoracard Dec 12, 2023
6eab420
Update README.es.md
josemoracard Dec 12, 2023
a0496c6
Update app.py
josemoracard Dec 12, 2023
8bc0d06
Update solution.hide.py
josemoracard Dec 12, 2023
921abdd
Update solution.hide.py
josemoracard Dec 12, 2023
95d6272
Update test.py
josemoracard Dec 12, 2023
e6561bf
Update README.md
josemoracard Dec 12, 2023
4507046
Update README.es.md
josemoracard Dec 12, 2023
5a3e368
Update README.es.md
josemoracard Dec 12, 2023
7a1d8cc
Update README.es.md
josemoracard Dec 12, 2023
2bce900
Update app.py
josemoracard Dec 12, 2023
02ab803
Update solution.hide.py
josemoracard Dec 12, 2023
bf5ce84
Update solution.hide.py
josemoracard Dec 12, 2023
667b3b1
Update app.py
josemoracard Dec 12, 2023
dea53a9
Update README.md
josemoracard Dec 12, 2023
62707b5
Update README.es.md
josemoracard Dec 12, 2023
e4e89c3
Update app.py
josemoracard Dec 12, 2023
ef6b111
Update solution.hide.py
josemoracard Dec 12, 2023
73fb1b7
Update solution.hide.py
josemoracard Dec 12, 2023
59558da
Update app.py
josemoracard Dec 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/001-hello_world/app.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# your code here
# Your code here
2 changes: 2 additions & 0 deletions exercises/001-hello_world/solution.hide.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Your code here
print("Hello World")
4 changes: 2 additions & 2 deletions exercises/002-sum_of_three_numbers/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

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
3
6
```

## Ejemplo de salida:
## 📎 Ejemplo de salida:

```py
11
Expand Down
4 changes: 2 additions & 2 deletions exercises/002-sum_of_three_numbers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

1. Taking 3 numbers from the input, print their sum. Every number is given on a separate line.

## Example input:
## 📎 Example input:

```py
2
3
6
```

## Example output:
## 📎 Example output:

```py
11
Expand Down
11 changes: 6 additions & 5 deletions exercises/002-sum_of_three_numbers/app.py
Original file line number Diff line number Diff line change
@@ -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)

# Print here the sum of all three inputs
print(first_number+second_number)
8 changes: 8 additions & 0 deletions exercises/002-sum_of_three_numbers/solution.hide.py
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 6 additions & 5 deletions exercises/003-area_of_right_triangle/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/
12 changes: 6 additions & 6 deletions exercises/003-area_of_right_triangle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/
6 changes: 3 additions & 3 deletions exercises/003-area_of_right_triangle/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions exercises/003-area_of_right_triangle/solution.hide.py
Original file line number Diff line number Diff line change
@@ -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))
print(area_of_triangle(3, 5))
16 changes: 8 additions & 8 deletions exercises/004-hello_harry/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
12 changes: 7 additions & 5 deletions exercises/004-hello_harry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
6 changes: 3 additions & 3 deletions exercises/004-hello_harry/app.py
Original file line number Diff line number Diff line change
@@ -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"))
6 changes: 3 additions & 3 deletions exercises/004-hello_harry/solution.hide.py
Original file line number Diff line number Diff line change
@@ -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"))
12 changes: 7 additions & 5 deletions exercises/005-previous_and_next/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/
13 changes: 8 additions & 5 deletions exercises/005-previous_and_next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/
7 changes: 4 additions & 3 deletions exercises/005-previous_and_next/app.py
Original file line number Diff line number Diff line change
@@ -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))
# Invoke the function with any integer as its argument
print(previous_next(179))
7 changes: 4 additions & 3 deletions exercises/005-previous_and_next/solution.hide.py
Original file line number Diff line number Diff line change
@@ -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))
# Invoke the function with any integer as its argument
print(previous_next(179))
2 changes: 1 addition & 1 deletion exercises/005-previous_and_next/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
18 changes: 9 additions & 9 deletions exercises/006-apple_sharing/README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
+ También puedes intentar paso a paso con trozos de la teoría: https://snakify.org/lessons/print_input_numbers/steps/1/
19 changes: 9 additions & 10 deletions exercises/006-apple_sharing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
+ You may also try step-by-step theory chunks: https://snakify.org/lessons/print_input_numbers/steps/1/
Loading