Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fruit = input()
- size = input()
- volume = int(input())
- sum_fruit = 0
- if fruit == "Watermelon":
- if size == "small":
- sum_fruit = 56 * 2
- elif size == "big":
- sum_fruit = 28.7 * 5
- elif fruit == "Mango":
- if size == "small":
- sum_fruit = 36.66 * 2
- elif size == "big":
- sum_fruit = 19.6 * 5
- elif fruit == "Pineapple":
- if size == "small":
- sum_fruit = 42.1 * 2
- elif size == "big":
- sum_fruit = 24.8 * 5
- elif fruit == "Raspberry":
- if size == "small":
- sum_fruit = 20 * 2
- elif size == "big":
- sum_fruit = 15.2 * 5
- total = sum_fruit * volume
- if 400 <= total <= 1000:
- total *= 0.85
- elif total > 1000:
- total /= 2
- print(f'{total:.2f} lv.')
- Решение с тернарен оператор:
- fruit = input()
- size = input()
- volume = int(input())
- sum_fruit = 0
- if fruit == "Watermelon":
- sum_fruit = 112 if size == "small" else 143.5
- elif fruit == "Mango":
- sum_fruit = 73.32 if size == "small" else 98
- elif fruit == "Pineapple":
- sum_fruit = 84.2 if size == "small" else 124
- elif fruit == "Raspberry":
- sum_fruit = 40 if size == "small" else 76
- total = sum_fruit * volume
- if total >= 400:
- if total <= 1000:
- total *= 0.85
- else:
- total /= 2
- print(f'{total:.2f} lv.')
- Фундаменталс решение:
- fruit = input()
- size = input()
- volume = int(input())
- price = {"Watermelon": {"small": 112, "big": 143.5},
- "Pineapple": {"small": 84.2, "big": 124},
- "Raspberry": {"small": 40, "big": 76},
- "Mango": {"small": 73.32, "big": 98}}[fruit][size] * volume
- price = {price < 400: price, 400 <= price <= 1000: price * 0.85, price > 1000: price / 2}
- print(f'{price[True]:.2f} lv.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement