We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 793a212 commit f5ebb6eCopy full SHA for f5ebb6e
172/curry.py
@@ -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
@@ -0,0 +1,13 @@
+from curry import rounder_int, rounder_detailed
+def test_rounder_int_partial():
+ assert rounder_int(1.3434587383) == 1
+ assert rounder_int(10.42342) == 10
+ assert rounder_int(1.99) == 2
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