I am going to try to explain this the best I can. I have a task to make a pay phone price calculator based on day, duration, and time call started. I did two of the if statements and realized whenever I put in my answers all it does is print the result off the most recent if statement and does not really listen to what I want it to do. It is a bit hard to explain so I will just put my code, my input, and my result.
Code:
day = str(input('Enter the day the call started at: '))
start_time = float(input('Enter the time the call started at (hhmm): '))
duration = float(input('Enter the duration of the call (in minutes):'))
cost = duration
if (start_time >= 08.00 and start_time <= 18.00 and day == "Mon" or "Tue" or "Wed" or "Thr" or "Fri"):
cost = duration * 0.40
if (start_time < 08.00 and start_time > 18.00 and day == "Mon" or "Tue" or "Wed" or "Thr" or "Fri"):
cost = duration * 0.25
print('$' + str(cost))
My inputs:
1: Fri, 2350, 22. 2: Sund, 2350, 22.
My results:
1: $5.5. 2: $5.5.
As you can see it did not even do what is inside the print statement. It just gave me the result of the outcome of the previous if statement. I also tried removing the "and day ==" and what is after and all that did is make the first print statement work fine while the second does not work it just prints my original duration so I think I messed up bad.