File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,14 @@ def perfect_cube_binary_search(n: int) -> bool:
26
26
>>> perfect_cube_binary_search("a")
27
27
Traceback (most recent call last):
28
28
...
29
- TypeError: '<=' not supported between instances of 'int' and 'str'
29
+ TypeError: perfect_cube_binary_search() only accepts integers
30
+ >>> perfect_cube_binary_search(0.1)
31
+ Traceback (most recent call last):
32
+ ...
33
+ TypeError: perfect_cube_binary_search() only accepts integers
30
34
"""
35
+ if not isinstance (n , int ):
36
+ raise TypeError ("perfect_cube_binary_search() only accepts integers" )
31
37
if n < 0 :
32
38
n = - n
33
39
left = 0
@@ -46,4 +52,4 @@ def perfect_cube_binary_search(n: int) -> bool:
46
52
if __name__ == "__main__" :
47
53
import doctest
48
54
49
- doctest .testmod ()
55
+ doctest .testmod ()
You can’t perform that action at this time.
0 commit comments