Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 513d429

Browse files
committed
done but with some questions
1 parent 3e57e34 commit 513d429

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

‎exercises/02.4-One_last_looping/README.es.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
2. Establece la última posición a `Pepe`.
88

9-
3. Define el valor del primer elemento al del 3er elemento concatenado con el valor del 5to elemento.
9+
3. Establece el valor del primer elemento con el del 3er elemento concatenado con el valor del 5to elemento.
1010

11-
4. Invierte el ciclo (desde el final hasta el principio) de toda la lista e imprime todos los elementos.
11+
4. Realiza un bucle en la lista en orden inverso (desde el final hasta el principio) e imprime todos los elementos..
1212

1313
## 💡 Pista:
1414

1515
- Recuerda que la posición inicial de la lista es 0.
16+
- Recuerda utilizar el bucle `for` en este ejercicio.
17+
- No debes utilizar ningún método para invertirlo en lugar de `for`.
1618
## Resultado esperado:
1719

1820
```py

‎exercises/02.4-One_last_looping/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ tutorial: "https://www.youtube.com/watch?v=ca1DZgLwy00"
1212

1313
3. Set the first element to the value of the 3rd element concatenated to the value of the 5th element.
1414

15-
4. Reverse loop (from the end to the beginning) the whole list and print all the elements.
15+
4. Loop the list in reverse order (from the end to the beginning) and print all the elements..
1616

1717
## 💡Hint:
1818

1919
- Remember that list start at position `0`.
20+
- Remember to use the `for` loop in this exercise.
21+
- You should not use any method to invert it instead of `for`.
2022

2123
## Expected result:
2224

Binary file not shown.

‎exercises/02.4-One_last_looping/test.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ def test_output(capsys, app):
1111
def test_for_loop():
1212
with open(path, 'r') as content_file:
1313
content = content_file.read()
14-
regex = re.compile(r"for(\s)+[a-zA-Z\-_]+(\s)+in(\s)+range.*")
15-
regex2 = re.compile(r"for(\s)+[a-zA-Z\-_]+(\s)+in(\s)+reversed.*")
16-
assert bool(regex.search(content)) == True or bool(regex2.search(content)) == True
14+
regex = re.compile(r"for(\s*)+\S+(\s*)+in(\s*)+range.*")
15+
assert bool(regex.search(content)) == True
16+
17+
@pytest.mark.it("You have to put Steven in the second place in the array.")
18+
def test_for_loop():
19+
with open(path, 'r') as content_file:
20+
content = content_file.read()
21+
regex = re.compile(r"my_sample_list\[\s*1\s*\]\s*\=\s*[\'\"]\s*Steven\s*[\'\"]")
22+
assert bool(regex.search(content)) == True
23+
24+
@pytest.mark.it("You have to put Steven in the second place in the array.")
25+
def test_for_loop():
26+
with open(path, 'r') as content_file:
27+
content = content_file.read()
28+
regex = re.compile(r"my_sample_list\[\s*1\s*\]\s*\=\s*[\'\"]\s*Steven\s*[\'\"]")
29+
assert bool(regex.search(content)) == True
30+
31+
@pytest.mark.it("Check the third point again")
32+
def test_for_loop():
33+
with open(path, 'r') as content_file:
34+
content = content_file.read()
35+
regex = re.compile(r"my_sample_list\[\s*0\s*\]\s*\=\s*my_sample_list\[\s*2\s*\]\s*\+\s*my_sample_list\[\s*4\s*\]")
36+
assert bool(regex.search(content)) == True

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /