Created
March 31, 2020 11:37
-
-
Save abrarShariar/4f9068f699d7c5ad4d7252c491782785 to your computer and use it in GitHub Desktop.
Light more light
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 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