Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1cb917a
Update README.md
josemoracard Dec 20, 2023
9f43e7b
Update README.md
josemoracard Dec 20, 2023
1efb3fc
Update README.md
josemoracard Dec 20, 2023
00c3fe6
Update README.md
josemoracard Dec 20, 2023
089413c
Update README.es.md
josemoracard Dec 20, 2023
d516d24
Update app.py
josemoracard Dec 20, 2023
13c5075
Update solution.hide.py
josemoracard Dec 20, 2023
65d5808
Update test.py
josemoracard Dec 20, 2023
26da269
Update README.md
josemoracard Dec 20, 2023
d6e0a42
Update README.md
josemoracard Dec 20, 2023
d0e5d1a
Update README.es.md
josemoracard Dec 20, 2023
5ecc779
Update app.py
josemoracard Dec 20, 2023
9a7ce14
Update solution.hide.py
josemoracard Dec 20, 2023
5d821e4
Update test.py
josemoracard Dec 20, 2023
7b8e1b4
Update README.md
josemoracard Dec 20, 2023
df0ab97
Update README.es.md
josemoracard Dec 20, 2023
f4b8bf4
Update README.md
josemoracard Dec 20, 2023
138fbdb
Create README.es.md
josemoracard Dec 20, 2023
dffdf0a
Update app.py
josemoracard Dec 20, 2023
ffd37e3
Update solution.hide.py
josemoracard Dec 20, 2023
acd5aa2
Update solution.hide.py
josemoracard Dec 20, 2023
2fcf548
Update test.py
josemoracard Dec 20, 2023
dd965a3
Update app.py
josemoracard Dec 20, 2023
6ce1552
Update README.md
josemoracard Dec 20, 2023
3edd0a9
Create README.es.md
josemoracard Dec 20, 2023
a995923
Update solution.hide.py
josemoracard Dec 20, 2023
e884a4a
Update README.md
josemoracard Dec 20, 2023
77aa06b
Update README.md
josemoracard Dec 20, 2023
bf712bb
Create README.es.md
josemoracard Dec 20, 2023
7012811
Update app.py
josemoracard Dec 20, 2023
fb8ae1d
Update solution.hide.py
josemoracard Dec 20, 2023
15acd9a
Update test.py
josemoracard Dec 20, 2023
d8e1d6e
Update solution.hide.py
josemoracard Dec 20, 2023
550fb6b
Update README.md
josemoracard Dec 20, 2023
9a405ef
Update README.es.md
josemoracard Dec 20, 2023
2ae5642
Update README.md
josemoracard Dec 20, 2023
3dda56b
Update README.es.md
josemoracard Dec 20, 2023
d800b6d
Update README.md
josemoracard Dec 20, 2023
5cd158c
Update app.py
josemoracard Dec 20, 2023
250508f
Create README.es.md
josemoracard Dec 20, 2023
6fa0295
Update solution.hide.py
josemoracard Dec 20, 2023
12ee33e
Update README.md
josemoracard Dec 20, 2023
7b9096b
Update README.es.md
josemoracard Dec 20, 2023
f975360
Update README.md
josemoracard Dec 20, 2023
796164d
Update README.es.md
josemoracard Dec 20, 2023
6dd5ebf
Update README.md
josemoracard Dec 20, 2023
b7c0e92
Update README.md
josemoracard Dec 20, 2023
a5c2f0b
Update README.md
josemoracard Dec 20, 2023
0dbb207
Update app.py
josemoracard Dec 20, 2023
90aad78
Update README.md
josemoracard Dec 20, 2023
acc046a
Update README.md
josemoracard Dec 20, 2023
94bd26d
Create README.es.md
josemoracard Dec 20, 2023
8e73ab0
Update solution.hide.py
josemoracard Dec 20, 2023
dcd7b76
Update test.py
josemoracard Dec 20, 2023
796f82b
Update README.md
josemoracard Dec 20, 2023
a808b91
Update README.es.md
josemoracard Dec 20, 2023
31dd906
Update README.md
josemoracard Dec 20, 2023
655efe1
Update README.es.md
josemoracard Dec 20, 2023
f3097b4
Update README.md
josemoracard Dec 20, 2023
7c3178a
Update README.es.md
josemoracard Dec 20, 2023
a7ecfcb
Update README.md
josemoracard Dec 20, 2023
232ebfe
Update README.es.md
josemoracard Dec 20, 2023
00f6e17
Update solution.hide.py
josemoracard Dec 20, 2023
2275edf
Update README.es.md
josemoracard Dec 20, 2023
7bc11bf
Update solution.hide.py
josemoracard Dec 20, 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
26 changes: 17 additions & 9 deletions exercises/28-sequence-of-lines/README.es.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# `28` Sequence of lines

Escribe un programa que acepte una secuencia de líneas como entrada y que luego imprima las líneas convirtiendo todos los caracteres en mayúscula.
## 📝 Instrucciones:

Supongamos le entregamos la siguiente entrada al programa:
Hello world
Practice makes perfect
El resultado debería ser este:
HELLO WORLD
PRACTICE MAKES PERFECT
1. Escribe la función `lines()`. Dado un string, haz que la función retorne todos los caracteres del string en mayúsculas.

Pistas:
En caso de que se le pasen entradas de datos a la pregunta, deben asumirse como entradas de la consola.
## 📎 Ejemplo de entrada:

```py
lines("Hello world, practice makes perfect")
```

## 📎 Ejemplo de salida:

```text
HELLO WORLD, PRACTICE MAKES PERFECT
```

## 💡 Pista:

+ Googlea cómo convertir un string a mayúsculas en Python.
31 changes: 19 additions & 12 deletions exercises/28-sequence-of-lines/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# `28` Sequence of lines

Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized.
Suppose the following input is supplied to the program:
Hello world
Practice makes perfect
Then, the output should be:
HELLO WORLD
PRACTICE MAKES PERFECT

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

Solution:
## 📝 Instructions:

1. Write a function `lines()`. Given a string, make the function return all the characters from the string capitalized.

## 📎 Example input:

```py
lines("Hello world, practice makes perfect")
```

## 📎 Example output:

```text
HELLO WORLD, PRACTICE MAKES PERFECT
```

## 💡 Hint:

+ Google how to capitalize a string in Python.
1 change: 1 addition & 0 deletions exercises/28-sequence-of-lines/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
3 changes: 2 additions & 1 deletion exercises/28-sequence-of-lines/solution.hide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Your code here
def lines(text):
return text.upper()

print(lines('Hello world'))
print(lines('Hello world, practice makes perfect'))
2 changes: 1 addition & 1 deletion exercises/28-sequence-of-lines/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def test_function_existence(capsys, app):
def test_expected_output(capsys, app):
assert app.lines("hello world") == "HELLO WORLD"

@pytest.mark.it('The function should return the expected output')
@pytest.mark.it('The function should return the expected output. Testing with a different value')
def test_another_output(capsys, app):
assert app.lines("LeT the WOrld know YoU") == "LET THE WORLD KNOW YOU"
23 changes: 14 additions & 9 deletions exercises/29-remove-duplicate-words/README.es.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# `29`Eliminar los duplicados
# `29` Remove duplicate words

Escribe un programa que acepte una secuencia de palabras separadas por espacios en blanco como entrada y que imprima luego las palabras eliminando todas las duplicadas y ordenándolas alfanuméricamente.
## 📝 Instrucciones:

Supongamos que se le entrega la siguiente entrada al programa:
1. Escribe la función `remove_duplicate_words()` que tome una secuencia de palabras separadas por espacios en blanco como entrada. Luego, retorna las palabras eliminando duplicados y organizándolas alfanuméricamente.

hello world and practice makes perfect and hello world again
## 📎 Ejemplo de entrada:

El resultado debería ser:
```py
remove_duplicate_words("hello world and practice makes perfect and hello world again")
```

again and hello makes perfect practice world
## 📎 Ejemplo de salida:

Pistas:
En caso de que se le entregue entradas de datos a la pregunta, debe asumirse como entrada de la consola.
```text
again and hello makes perfect practice world
```

Usa set container para eliminar los datos duplicados automáticamente y luego usa sorted() para ordenar los datos.
## 💡 Pistas:

+ Puedes convertir tu entrada en el tipo de dato `set` para eliminar automáticamente cualquier duplicado.

+ Puedes utilizar `sorted()` para ordenar los elementos de una lista.
25 changes: 18 additions & 7 deletions exercises/29-remove-duplicate-words/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# `29` Remove duplicate words

Write a program that accepts a sequence of whitespace separated words as input and prints the words after removing all duplicate words and sorting them alphanumerically.
Suppose the following input is supplied to the program:
hello world and practice makes perfect and hello world again
Then, the output should be:
## 📝 Instructions:

1. Write a function called `remove_duplicate_words()` that accepts a sequence of whitespace separated words as input 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:

```text
again and hello makes perfect practice world
```

## 💡 Hints:

Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
We use set container to remove duplicated data automatically and then use sorted() to sort the data.
+ You can convert your input into the `set` data type to automatically eliminate duplicates.

+ You can use `sorted()` to sort the data from a list.
4 changes: 1 addition & 3 deletions exercises/29-remove-duplicate-words/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
s = input()
words = [word for word in s.split(" ")]
print (" ".join(sorted(list(set(words)))))
# Your code here
3 changes: 3 additions & 0 deletions exercises/29-remove-duplicate-words/solution.hide.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Your code here
def remove_duplicate_words(text):
words = text.split()
return (" ".join(sorted(list(set(words)))))

print(remove_duplicate_words("hello world and practice makes perfect and hello world again"))
4 changes: 2 additions & 2 deletions exercises/29-remove-duplicate-words/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ def test_function_existence(capsys, app):
def test_expected_output(capsys, app):
assert app.remove_duplicate_words("hello world and practice makes perfect and hello world again") == "again and hello makes perfect practice world"

@pytest.mark.it('The function should work with other entries')
@pytest.mark.it('The function should work with other entries. Testing with different values')
def test_expected_output_2(capsys, app):
assert app.remove_duplicate_words("lets try this again with another try") == "again another lets this try with"

@pytest.mark.it('The function should work with other entries')
@pytest.mark.it('The function should work with other entries. Testing with different values')
def test_expected_output_3(capsys, app):
assert app.remove_duplicate_words("Jacke was Named Jacke by his mother") == "Jacke Named by his mother was"

28 changes: 28 additions & 0 deletions exercises/30-divisable-binary/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# `30` Divisable binary

## 📝 Instrucciones:

1. Escribe la función `divisible_binary()` que tome una secuencia de números binarios de 4 dígitos separados por comas como entrada y verifique si son divisibles por 5. Imprime los números que son divisibles por 5 en una secuencia separada por comas.

## 📎 Ejemplo de entrada:

```py
divisible_binary("0100,0011,1010,1001")
```

## 📎 Ejemplo de salida:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incluye una breve explicacion de como transformar numeros binarios a numeros reales

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


```py
1010
```

## 💡 Pista:

+ Para convertir números binarios en nuestros números enteros cotidianos (base 10 o decimal), es necesario incluir la base del número que ingresamos en el primer argumento (en este caso, base 2 o binario), y la función `int()` se encargará del resto. Sería así:

```py
binary = '0101'
decimal = int(binary, 2)

print(decimal) # Output: 5
```
33 changes: 26 additions & 7 deletions exercises/30-divisable-binary/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence.
Example:
0100,0011,1010,1001
Then the output should be:
# `30` Divisable binary

## 📝 Instructions:

1. Write a function `divisible_binary()` that takes a sequence of comma-separated 4-digit binary numbers as input and checks if they are divisible by 5. Print the numbers that are divisible by 5 in a comma-separated sequence.

## 📎 Example input:

```py
divisible_binary("0100,0011,1010,1001")
```

## 📎 Example output:

```py
1010
Notes: Assume the data is input by console.
```

## 💡 Hint:

+ To convert binary numbers into our everyday integer numbers (base 10 or decimal), you have to include the base of the number we input in the first argument (in this case, base 2 or binary), and the function `int()` will take care of the rest. Like this:

```py
binary = '0101'
decimal = int(binary, 2)

Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
print(decimal) # Output: 5
```
1 change: 1 addition & 0 deletions exercises/30-divisable-binary/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
19 changes: 11 additions & 8 deletions exercises/30-divisable-binary/solution.hide.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
def divisable_binary(text):
value=[]
items=[x for x in text.split(',')]
for p in items:
intp = int(p, 2)
if not intp%5:
value.append(p)
# Your code here
def divisible_binary(binary_sequence):
divisible_numbers = []
binary_numbers = [x for x in binary_sequence.split(',')]
for binary_num in binary_numbers:
int_binary_num = int(binary_num, 2)
if not int_binary_num % 5:
divisible_numbers.append(binary_num)

return (','.join(value))
return ','.join(divisible_numbers)

print(divisible_binary("1000,1100,1010,1111"))
10 changes: 5 additions & 5 deletions exercises/30-divisable-binary/test.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import pytest, io, sys, json, mock, re, os

@pytest.mark.it('The function divisable_binary must exist')
@pytest.mark.it('The function divisible_binary must exist')
def test_function_existence(capsys, app):
assert app.divisable_binary
assert app.divisible_binary

@pytest.mark.it('The function should return the expected output')
def test_expected_output(capsys, app):
assert app.divisable_binary("0100,0011,1010,1001") == "1010"
assert app.divisible_binary("0100,0011,1010,1001") == "1010"

@pytest.mark.it('The function should work with other parameters. testing with 1111,1000,0101,0000')
def test_expected_output_2(capsys, app):
assert app.divisable_binary("1111,1000,0101,0000") == "1111,0101,0000"
assert app.divisible_binary("1111,1000,0101,0000") == "1111,0101,0000"

@pytest.mark.it("The function should work with other parameters. Testing with 1000")
def test_expected_output_3(capsys, app):
assert app.divisable_binary("1000,1000,1000,1000") == ""
assert app.divisible_binary("1000,1000,1000,1000") == ""
5 changes: 5 additions & 0 deletions exercises/31-sum-eigth-digit/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `31` All digits even

## 📝 Instrucciones:

1. Define una función llamada `all_digits_even()` para identificar e imprimir todos los números entre 1000 y 3000 (inclusive) en los que cada dígito es un número par. Muestra los números resultantes en una secuencia separada por comas en una sola línea.
8 changes: 3 additions & 5 deletions exercises/31-sum-eigth-digit/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Write a program, which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.
The numbers obtained should be printed in a comma-separated sequence on a single line.
# `31` All digits even

Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
## 📝 Instructions:

Solution:
1. Define a function named `all_digits_even()` to identify and print all numbers between 1000 and 3000 (inclusive) where each digit is an even number. Display the resulting numbers in a comma-separated sequence on a single line.
1 change: 1 addition & 0 deletions exercises/31-sum-eigth-digit/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
17 changes: 11 additions & 6 deletions exercises/31-sum-eigth-digit/solution.hide.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
values = []
for i in range(1000, 3001):
s = str(i)
if (int(s[0])%2==0) and (int(s[1])%2==0) and (int(s[2])%2==0) and (int(s[3])%2==0):
values.append(s)
print ",".join(values)
# Your code here
def all_digits_even():
values = []
for i in range(1000, 3001):
s = str(i)
if (int(s[0]) % 2 == 0) and (int(s[1]) % 2 == 0) and (int(s[2]) % 2 == 0) and (int(s[3]) % 2 == 0):
values.append(s)

return ",".join(values)

print(all_digits_even())
22 changes: 22 additions & 0 deletions exercises/32-numbers-of-letters-and-digits/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `32` Number of letters and digits

## 📝 Instrucciones:

1. Escribe una función llamada `letters_and_digits()` que tome una oración como entrada y calcule la cantidad de letras y dígitos presentes en ella.

## 📎 Ejemplo de entrada:

```py
letters_and_digits("hello world! 123")
```

## 📎 Ejemplo de salida:

```text
LETTERS 10
DIGITS 3
```

## 💡 Pista:

+ Declara un diccionario para guardar ambas cuentas en una sola variable.
25 changes: 19 additions & 6 deletions exercises/32-numbers-of-letters-and-digits/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
Write a program that accepts a sentence and calculate the number of letters and digits.
Suppose the following input is supplied to the program:
hello world! 123
Then, the output should be:
# `32` Number of letters and digits

## 📝 Instructions:

1. Write a function named `letters_and_digits()` that takes a sentence as input and calculates the number of letters and digits present in it.

## 📎 Example input:

```py
letters_and_digits("hello world! 123")
```

## 📎 Example output:

```text
LETTERS 10
DIGITS 3
```

## 💡 Hint:

Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
+ Declare a dictionary for storing both counts in one variable.
1 change: 1 addition & 0 deletions exercises/32-numbers-of-letters-and-digits/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
Loading