Skip to content

Commit b126e0d

Browse files
committed
techno beat
1 parent c98c2f9 commit b126e0d

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

exercises/15-Techno_beat/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You are working with a DJ and he needs a program that can create a beats for his
88
2. For each Zero you will add to the string 'Boom'
99
3. For each One you will add to the string 'Drop the base'
1010

11-
Constraints
11+
# Constraints
1212
If you find the number One (1) three times in a row, should ALSO ADD to the string "!!!Break the base!!!"
1313

1414
```py
@@ -24,4 +24,6 @@ Drop the base Drop the base Drop the base !!!Break the base!!!
2424

2525

2626
💡Hints
27-
Remember to use helper variables
27+
Remember to use helper variables
28+
Declare a variable to store
29+
Declare a variable to count and sum

exercises/15-Techno_beat/app.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
def lyrics_generator(numbers):
2-
zero = []
3-
for x in numbers:
4-
if x == 1:
5-
zero.append("Drop the base")
6-
elif x == 0:
7-
zero.append("boom")
8-
return zero
91

2+
3+
# Your code go above, nothing to change after this line:
104
print(lyrics_generator([0,0,1,1,0,0,0]))
115
print(lyrics_generator([0,0,1,1,1,0,0,0]))
126
print(lyrics_generator([0,0,0]))

exercises/15-Techno_beat/test.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
sys.stdout = buffer = io.StringIO()
55

66

7-
import app.py
7+
import app
88
import pytest
99

10-
11-
12-
1310
@pytest.mark.it("Create a function lyrics_generator")
1411
def test_function():
1512
f = open(os.path.dirname(os.path.abspath(__file__)) +'/app.py')
1613
content = f.read()
17-
assert content.fint("lyrics_generator")
14+
assert content.find("lyrics_generator")
1815

1916

2017
@pytest.mark.it("Use for loop")
@@ -29,7 +26,7 @@ def test_conditinal():
2926
content = f.read()
3027
assert content.find("for")
3128

32-
@pytest.mark.it("Add the value to the new list")
29+
@pytest.mark.it("Store the value in the variable that you have to return")
3330
def test_append():
3431
f = open(os.path.dirname(os.path.abspath(__file__)) +'/app.py')
3532
content = f.read()
@@ -38,7 +35,7 @@ def test_append():
3835
@pytest.mark.it("Print the strings like song")
3936
def test_output():
4037
captured = buffer.getvalue()
41-
assert "\n" in captured
38+
assert "['boom', 'boom', 'Drop the base', 'Drop the base', 'boom', 'boom', 'boom']\n['boom', 'boom', 'Drop the base', 'Drop the base', 'Drop the base', '!!!Break the base', 'boom', 'boom', 'boom']\n['boom', 'boom', 'boom']\n['Drop the base', 'boom', 'Drop the base']\n['Drop the base', 'Drop the base', 'Drop the base', '!!!Break the base']\n" in captured
4239

4340

4441

0 commit comments

Comments
 (0)