[Tutor] Help.Please!

Brian Ngari brian0203ngari at gmail.com
Sat Nov 24 15:37:45 EST 2018


Hi there, I'm struggling mightily on this problem.
  Write a program that determines if you need an oil change. This program
should determine if your car needs an oil change. Assume you change your
oil every 7,500 miles and you want to change the oil if you’re within 500
miles of that number. Please prompt the user for the current mileage
recorded on the car and also for the mileage recorded on the car at the
time of the last oil change. Then, please let the user know if it’s time to
change the oil. Be sure to check for invalid entries (e.g., if the mileage
at the time of the last oil change is greater than the current mileage)
and, if there are invalid entries, please continue to prompt the user.
Here is my code:
 input('Enter the number of miles')
x=int(input('Enter the last milage you went for an oil change.'))

if x>5000:
 print('You need an oil change.')

else:
 x<5000
print('No oil change.')
I'm getting two different answers as outputs. I don't know why.
thanks for your help.


More information about the Tutor mailing list