After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you.

You will need a rental car in order for you to get around in your vacation. The manager of the car rental makes you some good offers.

Every day you rent the car costs $40. If you rent the car for 7 or more days, you get $50 off your total. Alternatively, if you rent the car for 3 or more days, you get $20 off your total.

Write a code that gives out the total amount for different days(d).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def rental_car_cost(d):
	

Solutions:
def rental_car_cost(d):
	result = d * 40
	if d >= 7:
		result -= 50
	elif d >= 3:
		result -= 20
	return result


def rental_car_cost(d):
	return d * 40 - (d > 2) * 20 - (d > 6) * 30


def rental_car_cost(d):
	discount = 0
	if d >= 7:
		discount = 50
	elif d >= 3:
		discount = 20
	return d * 40 - discount


def rental_car_cost(d):
	return 40 * d - ((50, 20)[d < 7], 0)[d < 3]


def rental_car_cost(d):
	return d * 40 - 20 * (d >= 3) - 30 * (d >= 7)


def rental_car_cost(d):
	total = d * 40
	if d >= 7:
		total -= 50
	elif d >= 3:
		total -= 20
	return total


def rental_car_cost(d):
	total_cost = d * 40
	if d >= 7:
		total_cost -= 50
	elif d >= 3:
		total_cost -= 20
	return total_cost


def rental_car_cost(d):
	discount = 50 if d > 6 else 20 if d > 2 else 0
	return d * 40 - discount


def rental_car_cost(d):
	return d * 40 - 50 if d >= 7 else d * 40 - 20 if d >= 3 else d * 40


def rental_car_cost(d):
	return 40 * d - 20 * (2 < d < 7) - 50 * (d > 6)


def rental_car_cost(d):
	total = d * 40
	if d >= 3 and d < 7:
		total -= 20
	if d >= 7:
		total -= 50
	return total


def rental_car_cost(d):
	r = 50 if d >= 7 else 20 if d >= 3 else 0
	return d * 40 - r


rental_car_cost = lambda d: d * 40 - (50 if d > 6 else 20 if d > 2 else 0)


def rental_car_cost(d):
	x = 40
	if d < 3:
		return d * x
	elif d < 7:
		return x * d - 20
	else:
		return x * d - 50


def rental_car_cost(d):
	total = 40 * d
	if d > 6:
		total = total - 50
	if d > 2 and d < 7:
		total = total - 20
	return total


rental_car_cost = lambda d: 40 * d - [0, 20, 50][(d >= 3) + (d >= 7)]


def rental_car_cost(d):
	cost = 40
	if int(d) < 3:
		cost = cost * d
	elif int(d) >= 3 and int(d) < 7:
		cost = cost * d
		cost = cost - 20
	elif int(d) >= 7:
		cost = cost * d
		cost = cost - 50
	return cost


def rental_car_cost(d):
	return d * 40 - (20 if d >= 3 else 0) - (30 if d >= 7 else 0)


def rental_car_cost(d):
	return 40 * d - 20 * (d < 7 and d >= 3) - 50 * (d >= 7)


def rental_car_cost(d):
	return (d * 40 - 50) * (d >= 7) or (d * 40 - 20) * (d >= 3) or d * 40


rental_car_cost = lambda d: d * 40 if d < 3 else d * 40 - 20 if d < 7 else d * 40 - 50


def rental_car_cost(days: int) -> int:
	return days * 40 - {days >= 3: 20, days >= 7: 50}.get(True, 0)


def rental_car_cost(d):
	return 40 * d - 50 if d > 6 else 40 * d - 20 if 3 <= d <= 6 else 40 * d


def rental_car_cost(d):
	return d * 40 if d <= 2 else d * 40 - 20 if d <= 6 else d * 40 - 50


def rental_car_cost(d):
	price = d * 40
	if d >= 7:
		price -= 50
	elif d >= 3 and d < 7:
		price -= 20
	return price


def rental_car_cost(d):
	if d == 1:
		return 40
	elif d >= 7:
		a = d * 40
		return a - 50
	elif 3 <= d < 7:
		a = d * 40
		return a - 20
	else:
		return d * 40


def rental_car_cost(d):
	if d >= 1 and d < 3:
		return 40 * d
	if d >= 3 and d < 7:
		return 40 * d - 20
	else:
		return 40 * d - 50


def rental_car_cost(days):
	if days >= 7:
		discount = 50
	elif days >= 3:
		discount = 20
	else:
		discount = 0
	return days * 40 - discount


def rental_car_cost(d):
	rent_cost = d * 40
	if d >= 7:
		rent_cost -= 50
	elif d >= 3:
		rent_cost -= 20
	return rent_cost


def rental_car_cost(d):
	count = 40
	if d >= 1 and d < 3:
		count = count * d
	elif d >= 3 and d < 7:
		count = count * d - 20
	elif d >= 7:
		count = count * d - 50
	return count


def rental_car_cost(d):
	sum = 40 * d
	if d >= 7:
		sum = sum - 50
	elif d >= 3:
		sum = sum - 20
	return sum


def rental_car_cost(d):
	_1_day = d * 40
	if d >= 7:
		_1_day -= 50
	elif d >= 3:
		_1_day -= 20
	return _1_day


def rental_car_cost(d):
	print(d)
	if d == 1 or d == 2:
		return 40 * d
	elif 3 <= d < 7:
		return d * 40 - 20
	else:
		return d * 40 - 50


def rental_car_cost(d):
	return d * 40 - (0 if d < 3 or d > 6 else 20) - (0 if d < 7 else 50)


def rental_car_cost(d):
	r = d * 40
	if d >= 7:
		r -= 50
	elif d >= 3:
		r -= 20
	return r


def rental_car_cost(d):
	if 0 < d < 3:
		return 40 * d
	if 2 < d < 7:
		return 40 * d - 20
	if d > 6:
		return 40 * d - 50


def rental_car_cost(days):
	return days * 40 - 20 * (days >= 3 and days < 7) - 50 * (days >= 7)


def rental_car_cost(d):
	amount = 40 * d
	if d >= 7:
		amount -= 50
	elif d >= 3:
		amount -= 20
	return amount


def rental_car_cost(d):
	return 40 * d - [0, 20, 50][(d > 2) + (d > 6)]


def rental_car_cost(d):
	if 0 < d < 3:
		return d * 40
	elif 2 < d < 7:
		return d * 40 - 20
	else:
		return 40 * d - 50


def rental_car_cost(d):
	days = d * 40
	if d >= 7:
		days -= 50
	if d >= 3 and d < 7:
		days -= 20
	return days


def rental_car_cost(d):
	print(d)
	if d < 3:
		return d * 40
	if 3 <= d < 7:
		return d * 40 - 20
	return d * 40 - 50


def rental_car_cost(d):
	x = 40 * d
	if d >= 3:
		if d >= 7:
			return x - 50
		return x - 20
	return x


def rental_car_cost(d):
	t = d * 40
	if d >= 3 and d < 7:
		t = t - 20
	if d >= 7:
		t = t - 50
	return t


def rental_car_cost(d):
	cost = 40 * d
	print(d)
	if d >= 3 and (not 7 <= d):
		cost -= 20
	if d >= 7:
		cost -= 50
	return cost


def rental_car_cost(d):
	car = 40
	if d < 3:
		return car * d
	if 3 <= d < 7:
		return car * d - 20
	if 7 <= d:
		return car * d - 50


def rental_car_cost(d):
	print(d)
	if d <= 2:
		return 40 * d
	if 2 < d < 7:
		return 40 * d - 20
	if d >= 7:
		return d * 40 - 50


rental_car_cost = lambda d: d * 40 - (d > 6 and 50 or (d > 2 and 20) or 0)


def rental_car_cost(d):
	daily = d * 40
	if d < 7 and d > 2:
		return daily - 20
	elif d > 6:
		return daily - 50
	else:
		return daily


def rental_car_cost(d):
	if d < 3:
		a = d * 40
		return a
	elif d >= 3 and d < 7:
		b = d * 40 - 20
		return b
	elif d >= 7:
		c = d * 40 - 50
		return c


def rental_car_cost(d):
	if d >= 7:
		return d * 40 - 50
	elif 3 <= d <= 6:
		return d * 40 - 20
	return d * 40


def rental_car_cost(d):
	daily_cost = d * 40
	if d >= 3 and d < 7:
		return daily_cost - 20
	elif d >= 7:
		return daily_cost - 50
	else:
		return daily_cost


def rental_car_cost(d):
	if d < 3:
		return 40 * d
	elif d in range(3, 7):
		return 40 * d - 20
	else:
		return 40 * d - 50