We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 94f0950 commit a544a42Copy full SHA for a544a42
maths/ceil.py
@@ -3,6 +3,7 @@
3
"""
4
import unittest
5
6
+
7
def ceil(x: float) -> int:
8
9
Return the ceiling of x as an Integral.
@@ -22,12 +23,11 @@ def ceil(x: float) -> int:
22
23
24
if not isinstance(x, (int, float)):
25
raise ValueError("Input must be a float or integer")
-
26
27
return int(x) if x - int(x) <= 0 else int(x) + 1
28
29
30
class TestCeil(unittest.TestCase):
31
def test_ceil_float(self):
32
self.assertEqual(ceil(1.5), 2)
33
@@ -45,5 +45,6 @@ def test_ceil_non_numeric(self):
45
46
if __name__ == "__main__":
47
import doctest
48
49
unittest.main()
- doctest.testmod()
50
+ doctest.testmod()
0 commit comments