# Obeleži sve kategorije koje odgovaraju problemu

### Još detalja - opišite nam problem

Uspešno ste prijavili problem!
Status problema i sve dodatne informacije možete pratiti klikom na link.
Nažalost nismo trenutno u mogućnosti da obradimo vaš zahtev.
Molimo vas da pokušate kasnije.

# Programs with Computation - Exercise¶

So far, we have learned how to load numbers in programs, how to perform computational operations on them, and how to print results.

We can now practice the lessons learned in a few simple math tasks.

### Example¶

Example - Celebration

Jessica and Oscar are organizing a celebration. The rented space accommodates 100 people, Jessica has so far invited 43, and Oscar 28.

Write a program that calculates and prints how much more space is available.

The problem can be solved as follows:

or like this:

While this may seem unnecessary here, the solution with variables is worth practicing. Programs that use variables can do much more than those without variables. For example, if we load values into a program, variables are necessary. Also, more complex calculations would be very incomprehensible if they could not be broken down into simpler steps, and for intermediate values we again need variables.

We mentioned earlier that we should try to give meaningful names to the variables. It doesn’t matter to the computer (it works equally well with any names), but when we calculate something that matters to us, using variables with meaningful names will help us understand that program after a long time. Also, such a program will be easier to understand by other people who read it.

How many items for 76 euros can be bought for 500 euros? How much money will remain if the largest possible number of items is bought?

The shorter (and less clear) version of the solution is

Write a clearer solution using variables.

If today is the 15th of the month and the month is 31 days, how many days are there until the 11th of the next month (at the same time)?

Your job is to write a solution in which the starting and calculated values are assigned to variables. By clicking on the “short solution” button you can see a short solution as a hint.

Task - purchase of 3 pieces

Ben has 20 euros and wants to buy 3 bicycle lamps for 1.58 euros each. How much money will he have left?

Write a program that uses variables for the starting and calculated values.

### Example¶

Example - paintwork

Philip prepares to paint the ceiling in one room. In order to know how much paint to buy, he needs to know the dimensions of the room and how many square meters covers one kilogram of paint. Write a program that loads the length of the room, the width of the room, an area that covers one kilogram of paint, and prints the required number of kilograms of paint.

Solution: