Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- year = input()
- type = input()
- net = input()
- month = int(input())
- price = 0
- if type == "Small":
- if year == "one":
- price = 9.98
- else:
- price = 8.58
- elif type == "Middle":
- if year == "one":
- price = 18.99
- else:
- price = 17.09
- elif type == "Large":
- if year == "one":
- price = 25.98
- else:
- price = 23.59
- elif type == "ExtraLarge":
- if year == "one":
- price = 35.99
- else:
- price = 31.79
- if net == "yes":
- if price <= 10:
- price += 5.50
- elif 10 < price <= 30:
- price += 4.35
- else:
- price += 3.85
- total = price * month
- if year == "two":
- total -= 3.75 * total / 100
- print(f"{total:.2f} lv.")
- Решение с тернарен оператор:
- year = input()
- type = input()
- net = input()
- months = int(input())
- price = \
- (9.98 if year == "one" else 8.58) if type == "Small" else \
- (18.99 if year == "one" else 17.09) if type == "Middle" else \
- (25.98 if year == "one" else 23.59) if type == "Large" else \
- (35.99 if year == "one" else 31.79) if type == "ExtraLarge" else 0
- price += (5.50 if price <= 10 else 4.35 if 10 < price <= 30 else 3.85) if net == "yes" else 0
- total = price * months * (0.9625 if year == "two" else 1)
- print(f"{total:.2f} lv.")
- Решение с колекция и тернарен оператор:
- year = input()
- type = input()
- net = input()
- months = int(input())
- price = {
- "Small": {"one": 9.98, "two": 8.58},
- "Middle": {"one": 18.99, "two": 17.09},
- "Large": {"one": 25.98, "two": 23.59},
- "ExtraLarge": {"one": 35.99, "two": 31.79}
- }[type][year]
- total = (price + ((5.50 if sum <= 10 else 3.85 if price > 30 else 4.35) if net == "yes" else 0)) * months
- print(f"{total * (0.9625 if year == 'two' else 1):.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement