You are a skier (marked below by the `X`). You have made it to the Olympics! Well done.

```
\_\_\_X\_
\*\*\*\*\*\
\*\*\*\*\*\*\
\*\*\*\*\*\*\*\
\*\*\*\*\*\*\*\*\
\*\*\*\*\*\*\*\*\*\\.\_\_\_\_/
```

Your job in this kata is to calculate the maximum speed you will achieve during your downhill run. The speed is dictated by the height of the mountain. Each element of the array is a layer of the mountain as indicated by the diagram above (and further below). So for this example the mountain has a height of 5 (5 rows of stars). `Speed` is `mountain height * 1.5`.

The jump length is calculated by `(mountain height * speed * 9) / 10`. Jump length should be rounded to 2 decimal places.

You must return the length of the resulting jump as a string in the following format:

* when less than 10 m: `"X metres: He's crap!"`
* between 10 and 25 m: `"X metres: He's ok!"`
* between 25 and 50 m: `"X metres: He's flying!"`
* when more than 50 m: `"X metres: Gold!!"`

So in the example case above, the right answer would be `"33.75 metres: He's flying!"`

Sadly, it takes a lot of time to make arrays look like mountains, so the tests wont all look so nice. To give an example, the above mountain would look as follows in most cases:

```
[*****, ******, *******, ********, *********]
```
Not as much fun, eh?

*p.s. if you think "metre" is incorrect, please [read this](https://en.wikipedia.org/wiki/Metre#Spelling)*

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Mathematics

Starter code: def ski_jump(mountain):
	

Solutions:
def ski_jump(mountain):
	height = len(mountain)
	speed = height * 1.5
	jump_length = height * speed * 9 / 10
	return f"{jump_length:.2f} metres: He's crap!" if jump_length < 10 else f"{jump_length:.2f} metres: He's ok!" if jump_length < 25 else f"{jump_length:.2f} metres: He's flying!" if jump_length < 50 else f'{jump_length:.2f} metres: Gold!!'


def ski_jump(mountain):
	x = len(mountain) ** 2 * 1.35
	y = {x < 10: "He's crap", 10 <= x < 25: "He's ok", 25 <= x < 50: "He's flying", 50 <= x: 'Gold!'}[True]
	return f'{x:.2f} metres: {y}!'


def ski_jump(mountain):
	distance = len(mountain) ** 2 * 1.35
	if distance <= 10:
		return f"{distance:.2f} metres: He's crap!"
	if distance <= 25:
		return f"{distance:.2f} metres: He's ok!"
	if distance <= 50:
		return f"{distance:.2f} metres: He's flying!"
	if distance > 50:
		return f'{distance:.2f} metres: Gold!!'


msg = ("He's crap!", "He's ok!", "He's flying!", 'Gold!!')

def ski_jump(M):
	l = round(1.35 * len(M) ** 2, 2)
	return f'{l:.2f} metres: {msg[(l > 10) + (l > 25) + (l > 50)]}'


def ski_jump(mountain):
	l = len(mountain) ** 2 * 1.35
	comment = 'Gold!' if 50 < l else f"He's {('crap' if l < 10 else 'ok' if l < 25 else 'flying')}"
	return f'{l:.2f} metres: {comment}!'


def ski_jump(mountain):
	length = round(1.35 * len(mountain) ** 2, 2)
	text = ("He's crap", "He's ok", "He's flying", 'Gold!')[(length >= 10) + (length >= 25) + (length > 50)]
	return f'{length:.2f} metres: {text}!'


def ski_jump(mountain):
	k = 0
	l = 0
	m = 0
	for i in mountain:
		i = mountain[k]
		k += 1
	l = k * 1.5
	m = k * l * 9 / 10
	if m < 10:
		m = '%.2f' % m
		m = str(m)
		m = m + " metres: He's crap!"
		return m
	elif m >= 10 and m <= 25:
		m = '%.2f' % m
		m = str(m)
		m = m + " metres: He's ok!"
		return m
	elif m >= 25 and m <= 50:
		m = '%.2f' % m
		m = str(m)
		m = m + " metres: He's flying!"
		return m
	else:
		m = '%.2f' % m
		m = str(m)
		m = m + ' metres: Gold!!'
		return m


def ski_jump(mountain):
	lenght = len(mountain) ** 2 * 1.5 * 9 / 10
	print(lenght)
	return f"{lenght:0.2f} metres: He's crap!" if lenght < 10 else f"{lenght:0.2f} metres: He's ok!" if 10 <= lenght < 25 else f"{lenght:0.2f} metres: He's flying!" if 25 <= lenght < 50 else f'{lenght:0.2f} metres: Gold!!' if 50 <= lenght else None


def ski_jump(mountain):
	height = len(mountain)
	speed = height * 1.5
	jumpLength = height * speed * 9 / 10
	output = {10: " metres: He's crap!", 25: " metres: He's ok!", 50: " metres: He's flying!", 1000: ' metres: Gold!!'}
	for case in output.keys():
		if jumpLength < case:
			return '{:.2f}{:s}'.format(jumpLength, output.get(case))


def ski_jump(mountain):
	speed = float(len(mountain[-1])) * 1.5
	jump = len(mountain[-1]) * speed * 9 / 10
	if jump < 10:
		res = "He's crap!"
	elif jump < 25:
		res = "He's ok!"
	elif jump < 50:
		res = "He's flying!"
	else:
		res = 'Gold!!'
	return '{:.2f}'.format(jump) + ' metres: ' + res