For6. Given a real number - the price of 1 kg of sweets. Output the cost of 1.2, 1.4, ..., 2 kg of sweets.

Solution in Python 3:

import random

price = round(random.uniform(0, 100),2)
print('Price of 1 kg of sweets: ', price)
print()
for i in range(0,5):
x = 1.2 + 0.2*i
print('Cost of {0:.1f} kg: {1:.2f}'.format(x, x * price))
print()