Codewars notes - Transportation on vacation

My Codewars

Exercise:

 Solution:

1.

def rental_car_cost(d):
    pd = 40 * d
    if d < 3:
        return pd
    elif d < 7:
        return pd - 20
    else:
        return pd - 50

2.

def rental_car_cost(d):
    return 40 * d - (20 * (2< d <7)) - (50 * (d >6))

 

posted @ 2022-06-29 17:37  大序列  阅读(15)  评论(0编辑  收藏  举报