Problem to print the result


#1

I have a problem to print the result.


I use print function befior and after line with return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money. If it' s before i have None in Console, if it's after return i have alert: "Oops, try again. It looks like nothing was printed to the console!"
Please HELP! I'd like to see the result of print function in console window.


Stuck in printing the cost_trip
#2

First of all you have to use print function after the return and it should not be inside the scope of trip_cost function.
After that read the instructions, it is written u have to print trip_cost to "Los Angeles" for 5 days with an extra 600 dollars of spending money. Write your code according to it.


#3

Thanks a lot :wink: I've change the code and it works. I had a letter bug too :wink: Only one thing i don't understand is that in first line i have def hotel_cost(night) but in the lastfunction in return i use hotel_cost(days) but it works anyway... :wink:


#4

nights is a locally defined variable that is visible only inside the hotel_cost function.

The parameter in trip_cost is days so that is the variable we need to pass to hotel_cost. That function will copy the value and use the copy locally.


#5

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