Jul-03-2017, 11:18 AM
(This post was last modified: Jul-03-2017, 11:48 AM by ichabod801.)
my question here
I have been asked to create four functions, Hotel Cost,Plane Cost, Car Rental and Holiday Cost
Thanks
my code hereI am new python user as i have embark to do programming, i have a task to complete but i having some challenges.
I have been asked to create four functions, Hotel Cost,Plane Cost, Car Rental and Holiday Cost
#The first function is - Hotel cost and as to take number of nights as an argument. def hotel_cost(number_of_nights): return(450 *(number_of_nights)) # The second function is - Plane Cost and as to take city as an argument and return cost of flight. use if/else if statement in the function to retrieve a price base on chosen city. def plane_cost(city): if city == "Joburg": return(1500) elif city == "Cape Town": return(1800) elif city == "Jozi": return (1200) else: return(0) #The third function is Car rental and as to take days as an argument. def car_rental(days): return(250 *(days)) #The last function is Holiday cost and as to take three arguments, number of nights,city,days, and return total cost of your holiday. def holiday_cost(number_of_nights,city,days): cost = (hotel_cost(number_of_nights) + plane_cost(city) + car_rental(days)) return ("Total Holiday Cost:" + str(cost)) #and the last task to do on this project is to print the value of the holiday function to see the result, and thats where i am getting lost. i have trying this code print holiday_costPlease advise and assist as its also my first time to post i might made some mistake along.
Thanks