0

Daily Mileage Calculator

Below is a question that was first intended for Delphi students, but I need the answer in Python. I cannot paste a screenshot of the GUI, but it has 3 user inputs, one for morning, noon, and evening. Since they ask for the total distance until noon, I would assume the noon and evening distances aren't counted. The following program was developed to explain the use of OR and AND in a decision structure. You are required to write the code for the Midday Report. The report includes the sum of all distances completed for the day (i.e. until noon.) A comment on whether the distance is odd or even is included. However, if the distance exceeds 20km, then the user is recommended to 'Take a Break.' A zero total shows the comment 'What? Nothing yet!!' Would this answer be in the right direction? m = int(input("Enter distance: ")) if(m>20): print("Take it Easy") else if(m==0): print("What? Nothing!!")

15th May 2017, 1:06 PM
gorgamin
gorgamin - avatar
2 Respuestas
+ 1
The question asks for the sum of the distance traveled up until noon, yet you state that it only applies to the morning number. Does the question specify if you are to include the distance traveled from the 'previous' day? (noon->evening, evening->morning, morning->noon) I'm only confused because it asks for three user inputs, yet does not use two of them? As for if what you wrote sounds okay, here is what you wrote below in puesdocode: User enters something and it becomes the distance "m" if the distance is greater than 20, print to the screen ("take it easy!") Or if the distance is exactly 0, print to the screen ("what? Nothing!") On a final note, change 'else if' to 'elif m == 0'
15th May 2017, 2:24 PM
Sapphire
- 1
That is what I don't understand either. They ask for the mileage for that day only, so perhaps the report should be run just after returning from the noon run. That means the evening one (for the question anyway) is not applicable. Thanks! :)
15th May 2017, 8:18 PM
gorgamin
gorgamin - avatar