Skip to content

Instantly share code, notes, and snippets.

@abrarShariar
Created March 31, 2020 11:37
Show Gist options
  • Save abrarShariar/4f9068f699d7c5ad4d7252c491782785 to your computer and use it in GitHub Desktop.
Save abrarShariar/4f9068f699d7c5ad4d7252c491782785 to your computer and use it in GitHub Desktop.
Light more light
import math
def isPerfectSquare(x):
sr = math.sqrt(x)
return ((sr - math.floor(sr) - 0) == 0)
def main():
while True:
inp = int(input())
if inp == 0:
return
if inp == 1:
print('yes')
continue
# if perfect square then number of factors is odd
if isPerfectSquare(inp):
print("yes")
else:
print("no")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment