I was trying to learn Python when I came upon this question. I am not asking for you to answer the question for me, I just need some help. Note: I am only allowed to use loops and if statements etc. Nothing ahead. I don't understand where I can use loops to create this program or the formulas needed.
Your parents need to buy a new vehicle and they are trying to decide whether to purchase a hybrid or not. Hybrid vehicles produce less CO2 emissions and have better fuel efficiency compared to their non-hybrid counterpart. However, hybrid vehicles also cost a lot more money than their non-hybrid version. Help your parents make a decision as to which type of vehicle to buy (strictly in terms of the financial cost and not taking into account the environmental benefits). The typical family drives 20,000 kms each year and gas currently costs $1.30/litre.
Allow the user to enter the cost of the hybrid and non-hybrid vehicle along with the combined fuel efficiency of those vehicles. Also, allow the user to enter the average amount of kilometers they drive each year (note: the average is 20000 km/year). Then output how many years of ownership it will take for the two cars to equal in cost. Assume that the price of gas stays the same at $1.30/litre.
Obviously, the cost of gas will increase each year (this is called inflation). Incorporate into your calculation the idea that gas prices will rise by 3% each year (i.e. annual inflation rate is 3%).
This is what I have so far:
count=0
total=0
gas=1.30
avgkm=20000normalcost=input("Please enter the cost of the non-hybrid vehicle: ")
hybridcost=input("Please enter the cost of the hybrid vehicle: ")
fueleff=input("Please enter the combined fuel effiency of both vehicles: ")