i have also this program:
write a function called rental_car_costthat takes days as input and returns the
cost for renting a car for said number of days. The cost must abide by the
following conditions:
Every day you rent the car is $40.
If you rent the car for 3 or more days, you get $20 off your total.
If you rent the car for 7 or more days, you get $50 off your total. (This does
not stack with the 20 dollars you get for renting the car over 3 days.)
so i wrote the following code:
def rental_car_cost(days):
cost = 40*days
if days >= 7:
return cost - 50
elif days >= 3 and days < 7:
return cost - 20
else:
return cost
but it seems not to be right cause the computer answers: Oops, try again! Did
you create a function called rental_car_cost?
ii wrote also:
def rental_car_cost(days):
if days >= 7:
return (40*days) - 50
if days >= 3 and < 7:
return (40*days) - 20
else:
return (40*days)
they both work in python shell/idle but not in the exercise in
"codecademy"..what do you think? is there a bug?
thanks!
kindest regards
--
http://mail.python.org/mailman/listinfo/python-list