0
Hello, I recently started my study in Python Programming Logic. I have a small base in C. I came across an exercise on the Internet where it says the following:
"Make a Program for a paint shop. The program should ask for the size in square meters of the area to be painted. Consider that the paint cover is 1 liter for every 6 square meters and that the paint is sold in 18 liter cans, which cost R $ 80,00 or 3,6 liter gallons, which cost R $ 25,00. Inform the user the quantities of ink to be purchased and the respective prices in 3 situations:
- buy only 18 liter cans;
- buy only 3.6 liter gallons;
- mix cans and gallons so that the waste of paint is less. Add 10% off and always round up the values, that is, consider full cans."
The problem is that I arrived in the third scenario and could not develop the right thinking of how I should do to calculate the form of higher cost x benefit. Could someone give a hint and let me know if the logic I’m following is correct ?
Code:
metros = float(input("Informe os m²: "))
litros = metros/6
if(metros%108 > 0 and metros%21.6>0):
latas = metros//108
latas = latas + 1
preçol = latas * 80
galao = metros//21.6
galao = galao + 1
preçog = galao * 25
print("Você vai precisar de: {} latas de 18L e vai gastar {} reais".format(latas,preçol))
else:
latas = metros/108
preçol = latas * 80
galao = metros/21.6
preçog = galao * 25
print("Você vai precisar apenas de {} latas de 18L e vai gastar {} reais".format(latas,preçol))
print("Você vai precisar apenas de {} galao de 3,6L e vai gastar {} reais".format(galao,preçog))