Help with the Python basics, floats and functions - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with the Python basics, floats and functions

HeavymetalvepHeavymetalvep Posts: 5Member
Write a python program that uses functions. The program should ask the user the same 2 questions 3 times. The first question is "How many miles did you travel before you filled up your tank?" (Make sure this is stored as a float).
The second question will be "How many gallons did it take to fill up your tank?" (Again, make sure this is a float)
Use a function to ask the 2 questions. (re-using the code for the questions). Then use a third function to calculate the average miles per gallon of the three sets, and display the overall average to the user.
Remember, the first function should include both questions.




Sign In or Register to comment.