def highestPerfectSquare(n):
    """
    Function which returns the highest perfect square less than or equal to its parameter.
    
    Parameters:
        n (int or float); the number for which the highest perfect square below it is to calculated.

    Returns:
        ans(int); the highest perfect square less than or equal to 'n'

    Raises:
        Exception; If an unexpected error occurs. Eg; if user enters an negative value.
        
    """
    try:
        
        nearestInt = int(n**0.5) #Calculating sqaure root of n
        ans = (nearestInt) ** 2  #Simply squaring the nearestInt
        return ans
    
    except:
        
        print("Error in calculating highest perfect square. Please try again with a valid 'positive' number.")