Case13. Elements of an isosceles right-angled triangle are numbered as follows:
1 - cathetus \(a\),
2 - hypotenuse \(c = a \cdot \sqrt{2}\),
3 - height \(h\), lowered to hypotenuse \((h = c/2)\),
4 - area of \(S = c \cdot h/2\).

The number of one of these elements and its meaning are given. Output the values of the remaining elements of this triangle (in the same order).

Solution in Python 3:

import random
import math

r = {1 : "cathetus a", 2 : "hypotenuse c", 3 : "height h", 4 : "area S"}
d = []

i = random.randrange(1,5)
#i = 4
print("i : ", i)
N = random.randrange(1,100)
#N = 64
print(r[i],":",N)
if i == 1:
a = N
c = math.sqrt(2) * a
h = c / 2
S = c * h / 2
elif i == 2:
c = N
a = c / math.sqrt(2)
h = c / 2
S = c * h / 2
elif i == 3:
h = N
c = 2 * h
a = c / math.sqrt(2)
S = c * h / 2
elif i == 4:
S = N
c = math.sqrt(S * 4)
a = c / math.sqrt(2)
h = c / 2

d.append(a)
d.append(c)
d.append(h)
d.append(S)

print()
print("Elements of an isosceles right-angled triangle:")
for i in range(0,4):
print(r[i+1],":",d[i])