Calculation to buy fuel by value?

0

I'm doing a fuel pump program using classes, but I'm not sure how to calculate the amount of fuel for the value entered, can anyone give a light?

class BombaCombustivel():

    def __init__(sel, tipoComb, valorLitro, quantComb):
        self.tipoComb = tipoComb
        self.valorLitro = valorLitro
        self.quantComb = quantComb

    def abastecerPorValor(self):
        abastecerV = float(input("Valor a ser abastecido: "))
        tirarComb = **calculo aqui**
        abastecido = "Combustivel colocado: %d L"% tirarComb
        return abastecerV

    def abastecerPorLitro(self):
        abastecerL = int(input("Quantidade de litros: "))
        if abastecerL.isdigit():
            pagar = self.valorLitro * self.abastecerL
            valorPagar = "Valor a ser pago: R$ %f"% pagar

    def setAlterarValor(self):

    def setAlterarCombustivel(self):

    def setAlterarQuantidadeCombustivel(self):
    
asked by anonymous 01.11.2016 / 00:02

1 answer

3

Okay, you need to know how many gallons of fuel to put with real X. How about dividing the amount of money for the price of the fuel?

Considering that the price of the liter is 4 reais and the driver wants to put 100 reais, the quantity supplied should be 25 liters (% with%).

It's up to you to implement this in the code;)

    
01.11.2016 / 02:40