Skip to content

Commit 9acc9d3

Browse files
committed
need to update
2 parents d0f3179 + f240480 commit 9acc9d3

File tree

16 files changed

+127
-154
lines changed

16 files changed

+127
-154
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@
1313
*.pyc
1414
__pycache__/
1515
.pytest_cache/
16+
17+
!/.breathecode
18+
/.breathecode/**
19+
!/.breathecode/resets
20+
!/.breathecode/resets/**

.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ports:
66
onOpen: open-preview
77
tasks:
88
- command: >
9-
bc run:exercises -e=gitpod;
9+
bc run;
1010
# github:
1111
# prebuilds:
1212
# # enable for the master/default branch (defaults to true)

LICENSE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
2+
3+
By accessing Breathe Code we assume you accept these terms and conditions. Do not continue to use Breathe Code's content, applications or tutorials if you do not agree to take all of the terms and conditions stated on this page.
4+
5+
Unless otherwise stated, Breathe Code and/or its licensors own the intellectual property rights for all material on Breathe Code. All intellectual property rights are reserved. You may access this from Breathe Code for your own personal use subjected to restrictions set in these terms and conditions.
6+
7+
You must not:
8+
9+
* Republish material from Breathe Code
10+
* Sell, rent or sub-license material from Breathe Code
11+
* Reproduce, duplicate or copy material from Breathe Code
12+
* Redistribute content from Breathe Code
13+
14+
You can read the full version of Breathe Code's terms and conditions here: [Terms and Conditions](http://breatheco.de/terms-and-conditions)

exercises/01-hello-world/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# `01` Hello World
22

33
In Python, we use `print` to make the computer write anything we want (the content of a variable, a given string, etc.)
4-
in something called `"the console".`
4+
in something called `the console`.
55

66
Every language has a console, as it was the only way to interact with the users at the beginning
77
(before the Windows or MacOS arrived). Today, printing in the console is used mostly as a
@@ -15,6 +15,7 @@ print("How are you?")
1515
📝 Instructions:
1616

1717
```md
18-
Use the `print()` function to print `"Hello World"` on the console. Feel free to try other things as well.
18+
Use the `print()` function to print `Hello World` on the console.
1919
```
20+
Feel free to try other things as well.
2021

exercises/01-hello-world/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# On the next line, use Python's print function to say `Hello World` in the console (this exercise is case-sensitive!)
1+
# On the next line, use Python's print function to say `Hello World` in the console (this exercise is case-sensitive!)

exercises/01-hello-world/test.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,13 @@
1-
import io
2-
import sys
3-
import os
4-
sys.stdout = buffer = io.StringIO()
5-
6-
# from app import my_function
1+
import io, sys, os
72
import pytest
8-
import app
9-
10-
# @pytest.mark.it('Your code needs to print hello on the console')
11-
# def test_for_file_output(capsys):
12-
# captured = buffer.getvalue()
13-
# assert captured == "hello\n" #add \n because the console jumps the line on every print
14-
15-
# @pytest.mark.it('Your function needs to print "Hello Inside Function" on the console')
16-
# def test_for_function_output(capsys):
17-
# my_function()
18-
# captured = capsys.readouterr()
19-
# assert captured.out == "Hello Inside Function\n"
203

21-
# @pytest.mark.it('Your function needs to return True')
22-
# def test_for_function_return(capsys):
23-
# assert my_function() == True
24-
25-
@pytest.mark.it("Output 'Hello World'")
26-
def test_output():
27-
captured = buffer.getvalue()
28-
assert "Hello World\n" in captured
4+
@pytest.mark.it("Output 'Hello World' case sensitive")
5+
def test_output(capsys, app):
6+
app()
7+
captured = capsys.readouterr()
8+
assert "Hello World\n" == captured.out
299
# convert everything in the buffer to lower case, captured to lower case
3010

31-
3211
@pytest.mark.it("Use print function")
3312
def test_print():
3413
f = open(os.path.dirname(os.path.abspath(__file__)) + '/app.py')
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
my_list = ['sunday','monday','tuesday','wednesday','thursday','friday','saturday']
33

4-
#1. print the item here
4+
# 1. print the item here
55

6-
#2. change 'thursday'a value here to None
6+
# 2. change the position were 'thursday' is to None
77

8-
#3. print the position of step 2
8+
# 3. print that position now here
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
import io
2-
import sys
3-
sys.stdout = buffer = io.StringIO()
4-
5-
from app import my_list
6-
import pytest
1+
import io, sys, pytest
72

83
@pytest.mark.it('Your console have to print the 3rd item from the `list`')
9-
def test_output_one():
10-
print(my_list[2])
11-
captured = buffer.getvalue()
12-
assert "tuesday\n" in captured
4+
def test_output_one(capsys, app):
5+
app()
6+
captured = capsys.readouterr()
7+
assert "tuesday\n" in captured.out
138

149
@pytest.mark.it('Your code have to print the position of step 2')
15-
def test_output_two():
16-
print(my_list[2])
17-
captured = buffer.getvalue()
18-
assert "None\n" in captured
10+
def test_output_two(capsys, app):
11+
app()
12+
captured = capsys.readouterr()
13+
assert "None\n" in captured.out
1914

20-
@pytest.mark.it('Set index[4] to None')
15+
@pytest.mark.it('Set the position were thrusday is to None')
2116
def test_position_two():
17+
from app import my_list
2218
assert my_list[4] is None

exercises/01.2-Retrieve-items/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
my_list = [4,5,734,43,45,100,4,56,23,67,23,58,45,3,100,4,56,23]
22

3-
#Print in the console the 1st and 4th element from the list:
3+
# Print in the console the 1st element on the list
4+
5+
# Print in the console the 4th element on the list

exercises/01.2-Retrieve-items/test.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import io
2-
import sys
3-
sys.stdout = buffer = io.StringIO()
4-
5-
from app import my_list
6-
import pytest
1+
import io, sys, pytest
72

83

94
@pytest.mark.it('You have to print the 1st element of the list')
10-
def test_output_one():
11-
print(my_list[0])
12-
captured = buffer.getvalue()
13-
assert "4\n" in captured
5+
def test_output_one(capsys, app):
6+
app()
7+
captured = capsys.readouterr()
8+
assert "4\n" in captured.out
149

1510
@pytest.mark.it('You have to print the 4th element of the list')
16-
def test_output_fourd():
17-
print(my_list[3])
18-
captured = buffer.getvalue()
19-
assert "43\n" in captured
11+
def test_output_fourd(capsys, app):
12+
app()
13+
captured = capsys.readouterr()
14+
assert "43\n" in captured.out
2015

0 commit comments

Comments
 (0)