I'm working on this leetcode problem.
I am using print statements to debug my failing testcase (536870912).
When hardcoding the values directly (print(str(29.0 % 1 == 0))) I obtain the desired, correct result (True).
However, when using the num variable (num = 29.0), I do not obtain the correct result even though the logic should be the exact same (print(str(num % 1 == 0))) (False).
Any tips appreciated... I'm not really sure how to debug this one.
import math
class Solution(object):
    def isPowerOfTwo(self, n):
        """
        :type n: int
        :rtype: bool
        """
        # the only case 'log' can't check is '2**0'
        # so weed that out in a check
        if (n == 1):
            return True
        
        # this is a clever application of modulus
        # I'm not sure I would've figured out
        
        num = math.log(n, 2)
        print(str(num))
        is_pow_2 = (num % 1 == 0)
        print(str(is_pow_2))
        print(str(29.0 % 1 == 0))
        
        return (num % 1 == 0)
 
     
    