def rental_car_cost(days): price = int(days*40) if (days >= 7): return price-50 elif (days <7 & days >=3): return price-20 elif (days<3): return price else: return 0 days = raw_input("Enter number of days:") rental_car_cost(days)
This is the problem, there is a difference between a parameter and a variable.
quote="blogrockstar05782, post:1, topic:51575"]
days = raw_input("Enter number of days:")
What is a parameter? A parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine.
What is a variable? A variable is a value that can change, depending on conditions or on information passed to the program.
Thank you bandit. i am still unclear...tried to read couple of times and understood that I gave parameter but don't know what to do now. Can you explain lil brief please!
Finally figured it out as "&" operator issue. Used "and" in that place and it worked!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.