Python: Fuel Economy Calculation Program

I just started the Python Program, and as soon as I started, I aim to create an entry-level resource called 'Python and Automotive' by combining some of the formulas we have learned in Automotive Engineering with Python. Of course, I will not be limited to Automotive only and will try to create original codes and programs using basic engineering knowledge and formulas.

You can find the Python code of the Fuel Economy Calculation Program below. All explanations about the program are included in the pictures and code.

Process 1: Example: If the distance you travel with 50 liters of fuel is 1300 km, the average fuel consumption:


Process 2: Example: The fuel volume to be consumed by a vehicle traveling 750 km with an average fuel consumption of 5 L / 100 km:



Process 3: Example: The way you can get with a vehicle with 40 liters of fuel and 5 L / 100km fuel consumption:




Program's Python Code
print("""
************************************
Fuel Economy Calculator

FE=Fuel Economy,(L/100km)
FVC=Fuel Volume Consumed,(L)
RT=Road Taken,(km)
************************************
Please Select What You Want to Do:

1-Calculating Fuel Economy(L/100 km)

2-Calculating the Volume of Fuel Consumed(L)

3-Calculating the distance that can be taken(km)

************************************
Barış YILDIRIM
""")


while True:
Operation = input("Select the Operation:")

if (Operation == "1"):
FVC = float(input("Please enter the volume of fuel consumed value(L):"))
RT = float(input("Please enter the road taken value(km):"))
FE = (FVC * 100) / RT
print("Fuel Economy:",FE,"L/100 km")

elif (Operation == "2"):
FE = float(input("Please enter Fuel Economy value(L/100 km):"))
RT = float(input("Please enter the road taken value(km):"))

FVC = (FE * RT) / 100

print("Fuel Volume Consumed:",FVC,"L")

elif (Operation == "3"):
FVC = float(input("Please enter the volume of fuel consumed value(L):"))
FE = float(input("Please enter Fuel Economy value(L/100 km):"))
RT = (FVC * 100) / FE

print("The distance that can be taken:",RT,"km")













Hiç yorum yok:

Yorum Gönder