- #1
shivajikobardan
- 674
- 54
Code:
def find_next_square(sq):
# Return the next square if sq is a square, -1 otherwise
sq2=(sq**1/2)
xyz=isinstance(sq2, int)
if (xyz==True):
print("Is perfect square")
nextsq=sq+1
print("Next perfect square=",nextsq**2)
else:
print("Not perfect square")
return -1
n=int(input("Enter an integer"))
find_next_square(n)
Enter an integer25
Not perfect square
Expected output-:
Enter an integer25
Next perfect square=36