Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python perfect square

import math

def is_square(n):
    return n > -1 and math.sqrt(n) % 1 == 0


# Taking the input from user
number = int(input("Enter the Number: "))
if is_square(number):
    print(f'Your number: {number} is perfect square.')
else:
    print(f'Your number: {number} is not perfect square.')
 
PREVIOUS NEXT
Tagged: #python #perfect #square
ADD COMMENT
Topic
Name
4+6 =