Created
July 22, 2020 06:52
-
-
Save hamzafarooq/6a6991d2c490c840d70d140df3321a17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def powerof2(num): | |
if num <= 0: | |
return False | |
if num == 1: | |
return True | |
max = int(round(num/2,0)) | |
j=0 | |
for i in range(max+1): | |
if i*i==num: | |
j=1 | |
return (j==1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment