File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 571571 * [ Largest Subarray Sum] ( maths/largest_subarray_sum.py )
572572 * [ Least Common Multiple] ( maths/least_common_multiple.py )
573573 * [ Line Length] ( maths/line_length.py )
574+ * [ Liouville Lambda] ( maths/liouville_lambda.py )
574575 * [ Lucas Lehmer Primality Test] ( maths/lucas_lehmer_primality_test.py )
575576 * [ Lucas Series] ( maths/lucas_series.py )
576577 * [ Maclaurin Series] ( maths/maclaurin_series.py )
Original file line number Diff line number Diff line change @@ -17,16 +17,19 @@ def get_1s_count(number: int) -> int:
1717 >>> get_1s_count(-1)
1818 Traceback (most recent call last):
1919 ...
20- ValueError: the value of input must be positive
20+ ValueError: Input must be a non-negative integer
2121 >>> get_1s_count(0.8)
2222 Traceback (most recent call last):
2323 ...
24- TypeError: Input value must be an 'int' type
24+ ValueError: Input must be a non-negative integer
25+ >>> get_1s_count("25")
26+ Traceback (most recent call last):
27+ ...
28+ ValueError: Input must be a non-negative integer
2529 """
26- if number < 0 :
27- raise ValueError ("the value of input must be positive" )
28- elif isinstance (number , float ):
29- raise TypeError ("Input value must be an 'int' type" )
30+ if not isinstance (number , int ) or number < 0 :
31+ raise ValueError ("Input must be a non-negative integer" )
32+
3033 count = 0
3134 while number :
3235 # This way we arrive at next set bit (next 1) instead of looping
You can’t perform that action at this time.
0 commit comments