[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-10-06 08:22:12 +00:00
parent 7f6082004e
commit c1a52b40ab

View File

@ -1,5 +1,5 @@
def update_bit(n: int, pos: int, value: int) -> int: def update_bit(n: int, pos: int, value: int) -> int:
''' """
It is a program to update a bit at given position It is a program to update a bit at given position
Details:update the bit at position pos of the Details:update the bit at position pos of the
@ -16,13 +16,14 @@ def update_bit(n: int, pos: int, value: int) -> int:
7 7
>>> update_bit(10,0,1) #0b1011 >>> update_bit(10,0,1) #0b1011
11 11
''' """
mask = ~(1 << pos) mask = ~(1 << pos)
n = n & mask n = n & mask
return n | (value << pos) return n | (value << pos)
if __name__ == "__main__": if __name__ == "__main__":
import doctest import doctest
doctest.testmod() doctest.testmod()