Unit 4, Exercise 6/7


I’ve attached a screenshot of the correct code Python editor wanted from me. The only difference I had in my code prior to the provided image was on line 23, my variable was hotel_cost(days-1) instead of hotel_cost(days). In lesson 5/7, Python editor wanted me to use the argument days-1 for the variable hotel_cost(). I don’t understand how/why this would change in lesson 6/7 when the only difference is adding the argument spending_money to my previously defined variable trip_cost() in line 22.

If someone could explain this change to me and why it matters I would be so grateful.


Can you post a link to this exercise, please?


So I have some more screen shots that might help.

Screenshot #1 shows my variable with the argument hotel_cost(days-1) yielding incorrect math in the console. If you look closely, the answer should be 220 for a flight to Tampa for 0 days and 0 spending money.

I am blocked from posting a comparing screenshot for comparison. Nevertheless, the changed argument in my variable to hotel_cost(days) yields the correct math 220 for the same arguments used when I print my trip cost to Tampa trip_cost(“Tampa”, 0, 0)

I see there is a correlating difference of 140 between my usage of these two arguments for the variable hotel_cost. I guess my question is: what the heck is going on? XD




Links to lessons 5 and 6, respectively.


Pull it together

No explanation can be given for why the author would go to all that extra length and then not carry it forward.

There would be as many nights spent as there are days on the car rental. It seems more like pedantic license taking than meaningful instruction. If there was a point, it was lost in the generalization.


Okay I see. Well thanks for looking into it for me anyways.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.