Begin33. It is known that X kg of candies costs A rubles. Determine how much is 1 kg and Y kg of the same candies.

Solution in Python 3:

import random

X,Y = [random.randrange(1,10) for i in range(2)]
A = random.randrange(1000,10000)
price = A/X
cost_Y = price*Y

print(X,"kg = ",A," rubles")
print("1 kg = {0:.2f} rubles".format(price))
print("{0} kg = {1:.2f} rubles".format(Y,cost_Y))