问题描述
- 一个python学习中的问题
-
Below your existing code, define a function called rental_car_cost with an argument called days.
Calculate the cost of renting the car:
Every day you rent the car costs $40.
if you rent the car for 7 or more days, you get $50 off your total.
Alternatively (elif), if you rent the car for 3 or more days, you get $20 off your total.
You cannot get both of the above discounts.
Return that cost.
解决方案
def定义函数,然后if,elif,else定义各种情况,return返回结果
时间: 2024-10-28 03:01:57