Skip to content

Commit 8f47d9f

Browse files
authored
Fix type annotations for bit manipulation algorithms (TheAlgorithms#4056)
1 parent f3ba9b6 commit 8f47d9f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

bit_manipulation/binary_and_operator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm
22

33

4-
def binary_and(a: int, b: int):
4+
def binary_and(a: int, b: int) -> str:
55
"""
66
Take in 2 integers, convert them to binary,
77
return a binary number that is the

bit_manipulation/binary_or_operator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm
22

33

4-
def binary_or(a: int, b: int):
4+
def binary_or(a: int, b: int) -> str:
55
"""
66
Take in 2 integers, convert them to binary, and return a binary number that is the
77
result of a binary or operation on the integers provided.

bit_manipulation/binary_xor_operator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://www.tutorialspoint.com/python3/bitwise_operators_example.htm
22

33

4-
def binary_xor(a: int, b: int):
4+
def binary_xor(a: int, b: int) -> str:
55
"""
66
Take in 2 integers, convert them to binary,
77
return a binary number that is the

bit_manipulation/single_bit_manipulation_operations.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""Provide the functionality to manipulate a single bit."""
44

55

6-
def set_bit(number: int, position: int):
6+
def set_bit(number: int, position: int) -> int:
77
"""
88
Set the bit at position to 1.
99
@@ -21,7 +21,7 @@ def set_bit(number: int, position: int):
2121
return number | (1 << position)
2222

2323

24-
def clear_bit(number: int, position: int):
24+
def clear_bit(number: int, position: int) -> int:
2525
"""
2626
Set the bit at position to 0.
2727
@@ -37,7 +37,7 @@ def clear_bit(number: int, position: int):
3737
return number & ~(1 << position)
3838

3939

40-
def flip_bit(number: int, position: int):
40+
def flip_bit(number: int, position: int) -> int:
4141
"""
4242
Flip the bit at position.
4343

0 commit comments

Comments
 (0)