setting a condition for perfect square in python

Solutions on MaxInterview for setting a condition for perfect square in python by the best coders in the world

showing results for - "setting a condition for perfect square in python"
Jerónimo
30 Jul 2020
1import math
2
3# Taking the input from user
4number = int(input("Enter the Number"))
5
6root = math.sqrt(number)
7if int(root + 0.5) ** 2 == number:
8    print(number, "is a perfect square")
9else:
10    print(number, "is not a perfect square")