Skip to content
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

https://github.com/learnpack/learnpack/issues/722 #34

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions exercises/021-integral/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `021` integral

## 📝 Instrucciones:

1. Dado un número entero `n`, escribe una función `generate_dict()` que genera un diccionario que contiene `(i, i*i)` como un número entero entre 1 y n (ambos incluidos).

2. `generate_dict()` debe luego imprimir el diccionario.

## Ejemplo de entrada:

```py
generate_dict(8)
```
## Ejemplo de salida:

+ {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}

## 💡 Pistas:

+ En el caso de que se le pasen datos a la cuestión, deben asumirse como entradas de la consola.

+ Considera usar `dict()`.
23 changes: 23 additions & 0 deletions exercises/021-integral/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# `021` integral

## 📝 Instructions:

1. With a given integral number `n`, write a function `generate_dict` that generates a dictionary that contains `(i, i*i)` that is an integral number between 1 and n (both included).

2. `generate_dict` should then print the dictionary.

## Example input:

```py
generate_dict(8)
```

## Example output:

+ {1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}

## 💡 Hints:

+ In case of input data being supplied to the question, it should be assumed to be a console input.

+ Consider use `dict()`
File renamed without changes.
25 changes: 25 additions & 0 deletions exercises/022-list_and_tuple/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# `022` list and tuple

## 📝 Instrucciones:

1. Escribe una función `list_tuple()` que acepte una secuencia de números separados por comas como parámetro en un string y genere una lista y una tupla que contenga todos los números.

## Ejemplo de entrada:

```py
list_tuple("34,67,55,33,12,98")
```

## Ejemplo de salida:

```bash
['34', '67', '55', '33', '12', '98']
```
o
```bash
('34', '67', '55', '33', '12', '98')
```

## 💡 Pistas:

+ Usa el método `tuple()` para convertir la lista en una tupla.
27 changes: 27 additions & 0 deletions exercises/022-list_and_tuple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# `022` list and tuple

## 📝 Instructions:

1. Write a function `list_tuple()` which accepts a sequence of comma-separated numbers in a string as parameter and generate a list or a tuple which contains every number.

## Example input:

```py
list_tuple(34,67,55,33,12,98)
```

## Example output:

```bash
['34', '67', '55', '33', '12', '98']
```

or

```bash
('34', '67', '55', '33', '12', '98')
```

## 💡 Hints:

+ `tuple()` method may be used to convert the list into a tuple
File renamed without changes.
15 changes: 15 additions & 0 deletions exercises/023-class-with-two-methods/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `023` class with two methods

## 📝 Instrucciones:

1. Define una clase que tenga al menos dos métodos:

- `get_string`: obtener un string desde la entrada de la consola.

- `print_string`: imprimir el string en mayúscula.

2. Por favor incluye una función de prueba simple para probar los métodos de la clase.

## 💡 Pistas:

+ Usa el método __init__ para construir algunos parámetros.
15 changes: 15 additions & 0 deletions exercises/023-class-with-two-methods/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `24` class with two methods

## 📝 Instructions:

1. Define a class which has at least two methods:

- `get_string`: to get a string from console input

- `print_string`: to print the string in upper case.

2. Please include simple test function to test the class methods.

## 💡 Hint:

+ Use __init__ method to construct some parameters
13 changes: 13 additions & 0 deletions exercises/023-class-with-two-methods/solution.hide.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class input_out_string(object):
def __init__(self):
self.s = ""

def get_String(self):
self.s = raw_input()

def print_String(self):
print self.s.upper()

str_obj = input_out_string()
str_obj.get_string()
str_obj.print_String()
22 changes: 22 additions & 0 deletions exercises/024-print_formula/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `024` print_formula

## 📝 Instrucciones:

1. Escribe una función `print_formula()` que calcule e imprima el valor de acuerdo a la fórmula dada: `Q = Square root of [(2 * C * D)/H]`. El valor fijo de `C` es 50 y el `H` es 30. `D` es la variable cuyos valores deben ser ingresados como parámetros en la función.

## Ejemplo de entrada:

```py
print_formula(100,150,180)
```

## Ejemplo de salida:

+ 18,22,24

## 💡 Pistas:

+ Si el resultado retornado es un decimal, debería rendondearse a su valor más cercano (por ejemplo, si el resultado es `26.0`, debería imprimirse como `26`)

+ En el caso de que se le hayan entregado datos a la cuestión, deben asumirse como una entrada de la consola.

21 changes: 21 additions & 0 deletions exercises/024-print_formula/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `024` print formula

## 📝 Instructions:

1. Write a function `print_formula()` that calculates and prints the value according to the given formula: `Q = Square root of [(2 * C * D)/H]`. The fixed value of `C` is 50 and and the fixed value of `H` is 30. `D` is the variable whose values should be assigned through the parameters.

## Example input:

```py
print_formula(100,150,180)
```

## Example output:

+ 18,22,24

## 💡 Hints:

+ If the output received is in decimal form, it should be rounded off to its nearest value (for example, if the output received is `26.0`, it should be printed as `26`).

+ In case of input data being supplied to the question, it should be assumed to be a console input.
File renamed without changes.
22 changes: 22 additions & 0 deletions exercises/025-two_dimensional_array/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `025` two dimensional array

## 📝 Instrucciones:

1. Escribe una función `two_dimensional_array()` que reciba dos dígitos `X,Y` como entrada y retorne un array de dos dimensiones. El valor del elemento en la fila i-th y en la columna j-th del array debe ser `i*j`.

## Ejemplo de Entrada:

```py
two_dimensional_array(3,5)
```

## Ejemplo de Salida:

+ [[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]]

## 💡 Pistas:

+ i = 0,1.., X-1; j = 0,1, ­Y-1.

+ En el caso de que se le entreguen datos a la cuestión, debe asumirse como una entrada de la consola en un formulario separado por comas.

21 changes: 21 additions & 0 deletions exercises/025-two_dimensional_array/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# `025` two dimensional array

## 📝 Instructions:

1. Create a function `two_dimensional_array()` which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be `i*j`.

## Example input:

```py
two_dimensional_array(3,5)
```

## Example output:

+ [[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]]

## 💡 Hints:

+ i = 0,1.., X-1; j= 0,1, Y-1.

+ In case of input data being supplied to the question, it should be assumed to be a console input in a comma-separated form.
18 changes: 18 additions & 0 deletions exercises/026-sequence_of_words/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# `026` sequence of words

## 📝 Instrucciones:

1. Escribe una función `sequence_of_words()`. que reciba una lista de palabras y las retorne en un string separadas por comas después de ordenarlas alfabéticamente.

## Ejemplo de entrada:

```py
sequence_of_words("without","hello","bag","world")
```
## Ejemplo de salida:

+ "bag,hello,without,world"

## 💡 Pistas:

+ En el caso de que se le pasen datos a la cuestión, deben considerarse como entradas de la consola.
19 changes: 19 additions & 0 deletions exercises/026-sequence_of_words/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# `026` sequence of words

## 📝 Instructions:

1. Write a function `sequence_of_words()` that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically.

## Example input:

```py
sequence_of_words("without", "hello", "bag", "world")
```

## Example output:

"bag,hello,without,world"

## 💡 Hints:

+ In case of input data being supplied to the question, it should be assumed to be a console input.
28 changes: 28 additions & 0 deletions exercises/027-sequence_of_lines/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# `027` sequence of lines

## 📝 Instrucciones:

1. Escribe una función `lines()` que acepte un string como parámetro y convierta todos los caracteres en mayúscula.

## Ejemplo de entrada 1:

```py
lines("Hello world")
```

## Ejemplo de salida 1:

+ "HELLO WORLD"

## Ejemplo de entrada 2:

```py
lines("Practice makes perfect")
```
## Ejemplo de salida:

+ "PRACTICE MAKES PERFECT"

## 💡 Pista:

+ En caso de que se le pasen entradas de datos a la cuestión, deben asumirse como entradas de la consola.
28 changes: 28 additions & 0 deletions exercises/027-sequence_of_lines/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# `027` sequence of lines

## 📝 Instructions:

1. Write a function `lines()` that accepts a string as parameter and returns the string after making all the characters in the sentence capitalized.

## Example input 1:

```py
lines("Hello world")
```

## Example output 1:

+ "HELLO WORLD"

## Example input 2:

lines("Practice makes perfect")

## Example output 2:

+ "PRACTICE MAKES PERFECT"

## 💡 Hint:

+ In case of input data being supplied to the question, it should be assumed to be a console input.

23 changes: 23 additions & 0 deletions exercises/028-remove_duplicate_words/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# `028` remove duplicate words

## 📝 Instrucciones:

1. Escribe una función `remove_duplicate_words()` que reciba un string como entrada y que imprima luego las palabras eliminando todas las duplicadas y ordenándolas alfanuméricamente.

## Ejemplo de entrada:

```py
remove_duplicate_words("hello world and practice makes perfect and hello world again")
```

## Ejemplo de salida:

+ "again and hello makes perfect practice world"

## 💡 Pistas:

+ En caso de que se le entregue entradas de datos a la pregunta, debe asumirse como entrada de la consola.

+ Usa `set container` para eliminar los datos duplicados automáticamente y luego usa sorted() para ordenar los datos.


19 changes: 19 additions & 0 deletions exercises/028-remove_duplicate_words/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# `028` remove duplicate words

## 📝 Instructions:

1. Write a function `remove_duplicate_words()` that receives a string as parameter and returns the words after removing all duplicate words and sorting them alphanumerically.

## Example input:

```py
remove_duplicate_words("hello world and practice makes perfect and hello world again")
```

## Example output:

+ "again and hello makes perfect practice world"

## 💡 Hints:

+ We use set container to remove duplicated data automatically and then use sorted() to sort the data.
Loading