Begin35. The speed of the boat in still water is \(V\) km/h, the speed of the flow of the river \(U\) km/h \((U<V)\). Time of boat motion along the lake \(T_1\) h, and along the river (up the stream) - \(T_2\) h. Determine the path \(S\) traversed by the boat (path = time * speed). Take into account that when moving against the flow, the speed of the boat decreases by the value of the flow velocity.

Solution in Python 3:

import random

U,V = sorted(random.sample(range(10, 21), 2))
T1,T2 = [random.randrange(1,6) for i in range(2)]
Distance_Lake = V * T1
Distance_River = (V - U) * T2

print("Speed in the lake:",V)
print("Speed of the river:",U)
print("Speed in the river (up the stream):",V-U)
print("Time in the lake:",T1)
print("Time in the river:",T2)
print("Path in the lake:",Distance_Lake)
print("Path in the river:",Distance_River)