A carpet shop sells carpets in different varieties. Each carpet can come in a different roll width and can have a different price per square meter. 

Write a function `cost_of_carpet` which calculates the cost (rounded to 2 decimal places) of carpeting a room, following these constraints:

* The carpeting has to be done in one unique piece. If not possible, retrun `"error"`.
* The shop sells any length of a roll of carpets, but always with a full width.
* The cost has to be minimal.
* The length of the room passed as argument can sometimes be shorter than its width (because we define these relatively to the position of the door in the room).
* A length or width equal to zero is considered invalid, return `"error"` if it occurs.


INPUTS:

`room_width`, `room_length`, `roll_width`, `roll_cost` as floats.

OUTPUT:

`"error"` or the minimal cost of the room carpeting, rounded to two decimal places.

Difficulty: EASY
Starter code: def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	

Solutions:
def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	(x, y) = sorted((room_length, room_width))
	if y == 0 or x > roll_width:
		return 'error'
	if y < roll_width:
		return round(x * roll_width * roll_cost, 2)
	return round(y * roll_width * roll_cost, 2)


def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	if room_length > roll_width < room_width or room_length * room_width <= 0:
		return 'error'
	if room_length <= roll_width >= room_width:
		side = min(room_length, room_width)
	else:
		side = max(room_length, room_width)
	return round(side * roll_width * roll_cost, 2)


def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	if room_length > roll_width and room_width > roll_width or not room_length * room_width * roll_width:
		return 'error'
	[a, b] = sorted([room_length, room_width])
	if room_length <= roll_width and room_width <= roll_width:
		return round(roll_width * a * roll_cost, 2)
	return round(b * roll_width * roll_cost, 2)


def cost_of_carpet(l, w, roll, cost):
	if l > roll < w or l <= 0 or w <= 0:
		return 'error'
	res = 0
	if l <= roll < w:
		res = roll * w * cost
	elif w <= roll < l:
		res = roll * l * cost
	else:
		res = roll * min(w, l) * cost
	return round(res, 2)


def cost_of_carpet(rW, rL, cW, cCost):
	(rW, rL) = sorted((rW, rL))
	return 'error' if cW < rW or 0 in (rL, rW, cW) else round(min([rL] + [rW] * (rL <= cW)) * cW * cCost, 2)


def cost_of_carpet(l, w, r, c):
	if l == 0 or w == 0 or (l > r and w > r):
		return 'error'
	return round((min(l, w) if l <= r and w <= r else max(l, w)) * r * c, 2)


def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	if room_length <= 0 or room_width <= 0 or room_length > roll_width < room_width:
		return 'error'
	(x, y) = (min(room_length, room_width), max(room_length, room_width))
	if y > roll_width:
		return round(y * roll_width * roll_cost, 2)
	return round(x * roll_width * roll_cost, 2)


from math import ceil

def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	(w, l) = sorted([room_length, room_width])
	if room_length == 0 or room_width == 0 or roll_width < w:
		return 'error'
	if l <= roll_width:
		return round(w * roll_width * roll_cost, 2)
	else:
		return round(l * roll_width * roll_cost, 2)


def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	if 0 in [room_length, room_width]:
		return 'error'
	(mi, mx) = (min((room_length, room_width)), max((room_length, room_width)))
	(rw, rc) = (roll_width, roll_cost)
	return round(mi * rw * rc, 2) if mx <= roll_width else round(mx * rw * rc, 2) if roll_width >= mi else 'error'


def cost_of_carpet(room_length, room_width, roll_width, roll_cost):
	if roll_width < min(room_length, room_width):
		return 'error'
	elif room_length == 0 or room_width == 0:
		return 'error'
	cost_1 = roll_width * room_length * roll_cost if roll_width >= room_width else float('inf')
	cost_2 = roll_width * room_width * roll_cost if roll_width >= room_length else float('inf')
	return round(min(cost_1, cost_2), 2)