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 ec3675b

Browse files
Merge branch 'master' of https://github.com/Khrisefzm/master-python-programming-exercises into bug-exercise-23
2 parents 308f000 + 02c96dc commit ec3675b

File tree

171 files changed

+1837
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+1837
-400
lines changed

‎exercises/021-square_root/README.es.md

Lines changed: 25 additions & 0 deletions

‎exercises/021-square_root/README.md

Lines changed: 25 additions & 0 deletions

‎exercises/021-square_root/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Your code here
2+
import math
3+
4+
def square_root(number):
5+
result = round(math.sqrt(number), 2)
6+
return result
7+
8+
9+
print(square_root(50))

‎exercises/021-square_root/test.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import io, sys, os, re, pytest
2+
import app
3+
4+
@pytest.mark.it('You should create a function named square_root')
5+
def test_square_root_exists(app):
6+
try:
7+
from app import square_root
8+
assert square_root
9+
except AttributeError:
10+
raise AttributeError("The function 'square_root' should exist on app.py")
11+
12+
@pytest.mark.it('The function must return something')
13+
def test_function_return(capsys, app):
14+
assert app.square_root(25) != None
15+
16+
@pytest.mark.it('The function must return a float number')
17+
def test_function_return_type(capsys, app):
18+
assert type(app.square_root(25)) == type(1.0)
19+
20+
@pytest.mark.it('Testing the function square_root with the number 50, it should return 7.07')
21+
def test_square_root_50(app):
22+
try:
23+
assert app.square_root(50) == 7.07
24+
except AttributeError:
25+
raise AttributeError("The function 'square_root' should return the value 7.07")
26+
27+
@pytest.mark.it('Testing the function square_root with the number 2.25, it should return 1.5')
28+
def test_square_root_2_25(app):
29+
try:
30+
assert app.square_root(2.25) == 1.5
31+
except AttributeError:
32+
raise AttributeError("The function 'square_root' should return the value 1.5")
33+
34+
@pytest.mark.it('Testing the function square_root with the number 0, it should return 0')
35+
def test_square_root_0(app):
36+
try:
37+
assert app.square_root(0) == 0
38+
except AttributeError:
39+
raise AttributeError("The function 'square_root' should return the value 0")

‎exercises/22-Integral/README.es.md renamed to ‎exercises/022-Integral/README.es.md

Lines changed: 1 addition & 1 deletion

‎exercises/22-Integral/README.md renamed to ‎exercises/022-Integral/README.md

Lines changed: 1 addition & 1 deletion
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
(0)

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