Complete the code to check if a number is a power of two using bitwise AND.
def is_power_of_two(n): return n > 0 and (n & ([1])) == 0
The expression n & (n - 1) clears the lowest set bit. For powers of two, this results in zero.
Complete the code to return False immediately if the number is not positive.
def is_power_of_two(n): if [1]: return False return (n & (n - 1)) == 0
Only positive numbers can be powers of two, so return False if n is zero or negative.
Fix the error in the code to correctly check if n is a power of two.
def is_power_of_two(n): if n <= 0: return False return (n & ([1])) == 0
The correct expression is n & (n - 1) to check if n is a power of two.
Fill both blanks to complete the function that returns True if n is a power of two, else False.
def is_power_of_two(n): if n [1] 0: return False return (n & (n [2] 1)) == 0
Check if n is less than or equal to zero to return False. Then use n - 1 in the bitwise AND.
Fill all three blanks to complete the function that checks if a number is a power of two.
def is_power_of_two(n): if n [1] 0: return False return (n [2] (n [3] 1)) == 0
Return False if n is less than or equal to zero. Then use bitwise AND (&) between n and n - 1.