diff --git a/bit_manipulation/README.md b/bit_manipulation/README.md index 2ef166152..e5f82a270 100644 --- a/bit_manipulation/README.md +++ b/bit_manipulation/README.md @@ -1,7 +1,6 @@ -https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations -https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations -https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types - -https://wiki.python.org/moin/BitManipulation -https://wiki.python.org/moin/BitwiseOperators -https://www.tutorialspoint.com/python3/bitwise_operators_example.htm +* https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations +* https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations +* https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types +* https://wiki.python.org/moin/BitManipulation +* https://wiki.python.org/moin/BitwiseOperators +* https://www.tutorialspoint.com/python3/bitwise_operators_example.htm diff --git a/bit_manipulation/binary_and_operator.py b/bit_manipulation/binary_and_operator.py index 191ff8eb4..36f6c668d 100644 --- a/bit_manipulation/binary_and_operator.py +++ b/bit_manipulation/binary_and_operator.py @@ -22,7 +22,7 @@ def binary_and(a: int, b: int) -> str: >>> binary_and(0, -1) Traceback (most recent call last): ... - ValueError: the value of both input must be positive + ValueError: the value of both inputs must be positive >>> binary_and(0, 1.1) Traceback (most recent call last): ... @@ -33,7 +33,7 @@ def binary_and(a: int, b: int) -> str: TypeError: '<' not supported between instances of 'str' and 'int' """ if a < 0 or b < 0: - raise ValueError("the value of both input must be positive") + raise ValueError("the value of both inputs must be positive") a_binary = str(bin(a))[2:] # remove the leading "0b" b_binary = str(bin(b))[2:] # remove the leading "0b" diff --git a/bit_manipulation/binary_or_operator.py b/bit_manipulation/binary_or_operator.py index dabf5bcb0..95f61f1da 100644 --- a/bit_manipulation/binary_or_operator.py +++ b/bit_manipulation/binary_or_operator.py @@ -21,7 +21,7 @@ def binary_or(a: int, b: int) -> str: >>> binary_or(0, -1) Traceback (most recent call last): ... - ValueError: the value of both input must be positive + ValueError: the value of both inputs must be positive >>> binary_or(0, 1.1) Traceback (most recent call last): ... @@ -32,7 +32,7 @@ def binary_or(a: int, b: int) -> str: TypeError: '<' not supported between instances of 'str' and 'int' """ if a < 0 or b < 0: - raise ValueError("the value of both input must be positive") + raise ValueError("the value of both inputs must be positive") a_binary = str(bin(a))[2:] # remove the leading "0b" b_binary = str(bin(b))[2:] max_len = max(len(a_binary), len(b_binary)) diff --git a/bit_manipulation/binary_xor_operator.py b/bit_manipulation/binary_xor_operator.py index 6f8962192..6206c70a9 100644 --- a/bit_manipulation/binary_xor_operator.py +++ b/bit_manipulation/binary_xor_operator.py @@ -22,7 +22,7 @@ def binary_xor(a: int, b: int) -> str: >>> binary_xor(0, -1) Traceback (most recent call last): ... - ValueError: the value of both input must be positive + ValueError: the value of both inputs must be positive >>> binary_xor(0, 1.1) Traceback (most recent call last): ... @@ -33,7 +33,7 @@ def binary_xor(a: int, b: int) -> str: TypeError: '<' not supported between instances of 'str' and 'int' """ if a < 0 or b < 0: - raise ValueError("the value of both input must be positive") + raise ValueError("the value of both inputs must be positive") a_binary = str(bin(a))[2:] # remove the leading "0b" b_binary = str(bin(b))[2:] # remove the leading "0b" diff --git a/sorts/bead_sort.py b/sorts/bead_sort.py index 26a3fabc4..d22367c52 100644 --- a/sorts/bead_sort.py +++ b/sorts/bead_sort.py @@ -21,15 +21,15 @@ def bead_sort(sequence: list) -> list: >>> bead_sort([1, .9, 0.0, 0, -1, -.9]) Traceback (most recent call last): ... - TypeError: Sequence must be list of nonnegative integers + TypeError: Sequence must be list of non-negative integers >>> bead_sort("Hello world") Traceback (most recent call last): ... - TypeError: Sequence must be list of nonnegative integers + TypeError: Sequence must be list of non-negative integers """ if any(not isinstance(x, int) or x < 0 for x in sequence): - raise TypeError("Sequence must be list of nonnegative integers") + raise TypeError("Sequence must be list of non-negative integers") for _ in range(len(sequence)): for i, (rod_upper, rod_lower) in enumerate(zip(sequence, sequence[1:])): if rod_upper > rod_lower: diff --git a/sorts/double_sort.py b/sorts/double_sort.py index 04e186820..4e08e27b3 100644 --- a/sorts/double_sort.py +++ b/sorts/double_sort.py @@ -1,7 +1,7 @@ def double_sort(lst): - """this sorting algorithm sorts an array using the principle of bubble sort, - but does it both from left to right and right to left, - hence i decided to call it "double sort" + """This sorting algorithm sorts an array using the principle of bubble sort, + but does it both from left to right and right to left. + Hence, it's called "Double sort" :param collection: mutable ordered sequence of elements :return: the same collection in ascending order Examples: