Skip to content

Commit f5ebb6e

Browse files
author
naipawat.poo@student.mahidol.ac.th
committedDec 29, 2019
bite 172
1 parent 793a212 commit f5ebb6e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
 

‎172/curry.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from functools import partial
2+
3+
# create 2 partials:
4+
# - 'rounder_int' rounds to int (0 places)
5+
# - 'rounder_detailed' rounds to 4 places
6+
rounder_int = partial(round, ndigits=0)# you code
7+
rounder_detailed = partial(round, ndigits=4)# you code
8+
#x

‎172/test_curry.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from curry import rounder_int, rounder_detailed
2+
3+
4+
def test_rounder_int_partial():
5+
assert rounder_int(1.3434587383) == 1
6+
assert rounder_int(10.42342) == 10
7+
assert rounder_int(1.99) == 2
8+
9+
10+
def test_rounder_detailed_partial():
11+
assert rounder_detailed(1.344587383) == 1.3446
12+
assert rounder_detailed(10.42342) == 10.4234
13+
assert rounder_detailed(1.99) == 1.9900

0 commit comments

Comments
 (0)
Please sign in to comment.