[comment]: # (Hello Contributors, the following guidelines in order of importance should help you write new translations and squash any pesky unintended bugs.)
[//]: # (The epsilon of all floating point test case comparisons is 0.01.)
[//]: # (Each test case shall pass if the statement "a^2 + b^2 = c^2" is true of the returned object.)
[//]: # (The test suite should contain 3 fixed test and exactly 512 random tests.)
[//]: # ( The following fixed test shall be used in the test suite as well as the example test suite:)
[//]: # (  {a: 3, b: 4, c: 5} from input {a: 3, b: 4})
[//]: # (  {a: 5, c: 13, b: 12} from input {a: 5, c: 13})
[//]: # (  {b: 2, c: 3, a: 2.236} from input {b: 2, c: 3})
[//]: # ( Random tests shall assign float values of a random range between 0.1-10.1 to properties a and b, and 14.5-114.5 to property c, after which, one of the properties is removed at random if target language allows for property insertions and deletions, or has its value replaced with either NaN if possible, or 0 if not.)
[//]: # (The test suite should not be sensitive to property insertion or placement order of the returned object.)
[//]: # (Validation attempts should not produce any errors outside the solution scope regardless of solution content.)

My tired eyes surveyed the horizon to spot a right triangle, made of an unknown material that sparkles in the endless void I have trekked thus far.

I hurried towards it. However far it seemed, it can't compare to the uncounted days I have been trapped here in this endless void. To break the monotony, it shall do nicely.

Reaching the triangle, I inspected it. It is even more spectacular up close than a far, like a piece of the heavens, just as grand as the best Hubble photo I've ever seen. Adorned onto its striking surface were two numbers, each hugging a side of the triangle in white chalk.

```python
{'a': 3, 'b': 4}
```

Almost unconsciously, I grabbed at the misshapen chalk piece in my pocket, a small stone shaped calcium oddity I found among the void. I am hit with the sudden urge to write on the cosmic shape, to complete the numbers by filling in the missing side. The shear burning desire scares me, but I did it anyway. With a bit of internal head math, I wrote down my solution.

```python
{'a': 3, 'b': 4, 'c': 5}
```

The triangle glowed white, contrasting almost blindingly against the surrounding darkness around me. Could it be, that solving this shape would be my salvation, my escape from this dark and empty place?

I stared at the shining geometry for what felt like ever, before, with a disappointed sigh, I glanced away from the mesmerizing false hope. Only to catch the sight of two more triangles of right angles.

```python
{'a': 5, 'c': 13}
{'b': 2, 'c': 3}
```

Somehow, I knew the third triangle had its first side unmarked, rather than its second, I'll have to take that into account were I to do this right. I idly solved them both, looking on in wonder as they too turned white.

```python
{'a': 5, 'b': 12, 'c': 13}
{'a': 2.236, 'b': 2, 'c': 3}
```

Something on the edge of my peripheral vision moved. I looked up, to be greeted with hundreds of right triangles, like angels from the heavens, coming down right at me.

I might need a better solution to turn them all shining white...

Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code:
def how_to_find_them(right_triangle):
	

Solutions:
def how_to_find_them(rt):
	return {d: rt[d] if d in rt else (rt['a'] ** 2 + rt['b'] ** 2) ** 0.5 if d == 'c' else (rt['c'] ** 2 - rt[(set('ab') - {d}).pop()] ** 2) ** 0.5 for d in 'abc'}


def how_to_find_them(right_triangle):
	result = dict(**right_triangle)
	if 'a' not in result:
		result['a'] = (result['c'] ** 2 - result['b'] ** 2) ** 0.5
	elif 'b' not in result:
		result['b'] = (result['c'] ** 2 - result['a'] ** 2) ** 0.5
	else:
		result['c'] = (result['a'] ** 2 + result['b'] ** 2) ** 0.5
	return result


def how_to_find_them(right_triangle):
	(a, b, c) = map(right_triangle.get, 'abc')
	if a is None:
		a = (c ** 2 - b ** 2) ** 0.5
	if b is None:
		b = (c ** 2 - a ** 2) ** 0.5
	if c is None:
		c = (a ** 2 + b ** 2) ** 0.5
	return {'a': a, 'b': b, 'c': c}


def how_to_find_them(t):
	a = t.get('a', 0)
	b = t.get('b', 0)
	c = t.get('c', 0)
	if not c:
		t['c'] = (a ** 2 + b ** 2) ** 0.5
	if not b:
		t['b'] = (c ** 2 - a ** 2) ** 0.5
	if not a:
		t['a'] = (c ** 2 - b ** 2) ** 0.5
	return t


from math import hypot, sqrt

def how_to_find_them(right_triangle):
	a = right_triangle['a'] if 'a' in right_triangle else None
	b = right_triangle['b'] if 'b' in right_triangle else None
	c = right_triangle['c'] if 'c' in right_triangle else None
	if not c:
		right_triangle['c'] = hypot(a, b)
	elif not b:
		right_triangle['b'] = sqrt(c ** 2 - a ** 2)
	else:
		right_triangle['a'] = sqrt(c ** 2 - b ** 2)
	return right_triangle


from math import hypot, sqrt

def how_to_find_them(t):
	if 'c' in t:
		(x, y) = 'ab' if 'b' in t else 'ba'
		return dict(t, **{x: sqrt(t['c'] ** 2 - t[y] ** 2)})
	return dict(t, c=hypot(t['a'], t['b']))


def how_to_find_them(right_triangle):
	values = []
	for i in right_triangle:
		values.append(i)
	if 'a' in values and 'b' in values:
		c = (right_triangle.get('a') ** 2 + right_triangle.get('b') ** 2) ** (1 / 2.0)
		right_triangle['c'] = c
		return right_triangle
	elif 'a' in values and 'c' in values:
		b = (right_triangle.get('c') ** 2 - right_triangle.get('a') ** 2) ** (1 / 2.0)
		right_triangle['b'] = b
		return right_triangle
	else:
		a = (right_triangle.get('c') ** 2 - right_triangle.get('b') ** 2) ** (1 / 2.0)
		right_triangle['a'] = a
		return right_triangle


how_to_find_them = lambda t: {a: a in t and t[a] or (t[b] ** 2 + (1 | -(a < 'c')) * t[c] ** 2) ** 0.5 for (a, b, c) in zip('abc', 'cca', 'bab')}


def how_to_find_them(right_triangle):
	if 'a' not in right_triangle:
		right_triangle['a'] = round((right_triangle['c'] ** 2 - right_triangle['b'] ** 2) ** 0.5, 3)
	elif 'b' not in right_triangle:
		right_triangle['b'] = round((right_triangle['c'] ** 2 - right_triangle['a'] ** 2) ** 0.5, 3)
	else:
		right_triangle['c'] = round((right_triangle['a'] ** 2 + right_triangle['b'] ** 2) ** 0.5, 3)
	return right_triangle