Find the area of a rectangle when provided with one diagonal and one side of the rectangle. If the input diagonal is less than or equal to the length of the side, return "Not a rectangle". If the resultant area has decimals round it to two places.

`This kata is meant for beginners. Rank and upvote to bring it out of beta!`

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def area(d, l):
	

Solutions:
def area(d, l):
	return 'Not a rectangle' if d <= l else round(l * (d * d - l * l) ** 0.5, 2)


import math

def area(diagonal, side):
	if diagonal <= side:
		return 'Not a rectangle'
	return round(math.sqrt(diagonal ** 2 - side ** 2) * side, 2)


def area(d, l):
	if d <= l:
		return 'Not a rectangle'
	else:
		return round(l * (d ** 2 - l ** 2) ** (1 / 2), 2)


def area(d, l):
	c = (d * d - l * l) ** 0.5
	area = c * l
	if d <= l:
		return 'Not a rectangle'
	else:
		return round(area, 2)
area(6, 4)


import math

def area(d, l):
	if l >= d:
		return 'Not a rectangle'
	x = math.sqrt(d * d - l * l)
	a = x * l
	return round(a, 2)


import math

def area(d, l):
	if d < l or d == l:
		return 'Not a rectangle'
	if l == 0 and d == 0:
		return 'Not a rectangle'
	x = math.sqrt(d ** 2 - l ** 2)
	ar = round(x * l, 2)
	return ar


import math

def area(d, l):
	if d <= l:
		return 'Not a rectangle'
	s2 = d ** 2 - l ** 2
	s = math.sqrt(s2)
	return round(l * s, 2)