Module: (Python) Loops. Loop with counter - for


Problem

5/15

for loop statement - Task 2

Theory Click to read/hide

Remember: in order to display the required number of decimal places, you need to use the command format().
For example, to display the value of a real variable with an accuracy of 4 decimal places, you need to write it like this:

x = 1.24323543
print("x = {:.4f}".format(x))  # on screen: x = 1.2432

 

Problem

Modify the program so that it displays a table of prices 1, 2, 3, 4, ... 20 pieces of a certain type of product, if one piece of goods costs 20.40 rubles
1 - 20.40 r
2 - 40.80r
...
20 - 408.00 r