For4. Given a real number - the price of 1 kg of candies. Output the cost of 1, 2, ..., 10 kg of candies.

Solution in Python 3:

import random

price = round(random.uniform(0, 100),2)
print('Price of 1 kg of candies: ', price)
print()
for i in range(1,11):
print("cost of ", i, 'kg: {0:.2f}'.format(i * price))