print('How Much I Spend On Gas')
Miles = float( input('How many miles driven? '))
Gas = float( input('How many gallons were used? '))
MPG = Miles / Gas
print('Miles per gallon used:', '%.2f' % MPG)
fuel_cost = float( input('Cost of Fuel?: ')
print('Total Cost:',( MPG * fuel_cost))
Getting a syntax error on line 7. Not sure why? Any help is appreciated.
It is an example I was using for a forum post. I have been trying out code and creating examples for practice and to become more proficient. You are correct it was from Python 3. Thank you for your assistance it works now, I was thrown off by the error being expressed in line 7, I’ll keep this in mind for the future. I’ll have to check my math I thought it was straight forward but I have been more concerned about the code.