diff --git a/Bit Algorithm/Check if A Number is Power of Two/SolutionByDhaval.py b/Bit Algorithm/Check if A Number is Power of Two/SolutionByDhaval.py new file mode 100644 index 000000000..203f07a6b --- /dev/null +++ b/Bit Algorithm/Check if A Number is Power of Two/SolutionByDhaval.py @@ -0,0 +1,18 @@ +int = int(input()) + + +def checkPowerOfTwo(num): + power = 0 + isPower = "No" + + while power <= int: + if 2 ** power == int: + isPower = "Yes" + break + else: + power += 1 + + return isPower + + +print(checkPowerOfTwo(int))