Advertisement
Spocoman

Painting Eggs

Feb 26th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. size = input()
  2. color = input()
  3. volume = int(input())
  4. egg_price = 0
  5.  
  6. if color == "Red":
  7.     if size == "Large":
  8.         egg_price += 16
  9.     elif size == "Medium":
  10.         egg_price += 13
  11.     elif size == "Small":
  12.         egg_price += 9
  13.  
  14. elif color == "Green":
  15.     if size == "Large":
  16.         egg_price += 12
  17.     elif size == "Medium":
  18.         egg_price += 9
  19.     elif size == "Small":
  20.         egg_price += 8
  21.  
  22. elif color == "Yellow":
  23.     if size == "Large":
  24.         egg_price += 9
  25.     elif size == "Medium":
  26.         egg_price += 7
  27.     elif size == "Small":
  28.         egg_price += 5
  29.  
  30. print(f"{egg_price * volume * 0.65:.2f} leva.")
  31.  
  32.  
  33. Решение с колекция:
  34.  
  35. size = input()
  36. color = input()
  37. volume = int(input())
  38. egg_price = {"Red": {"Large": 16, "Medium": 13, "Small": 9},
  39.              "Green": {"Large": 12, "Medium": 9, "Small": 8},
  40.              "Yellow": {"Large": 9, "Medium": 7, "Small": 5}}
  41.  
  42. total_sum = egg_price[color][size] * volume * 0.65
  43.  
  44. print(f"{total_sum:.2f} leva.")
  45.  
  46.  
  47. Тарикатско решение:)
  48.  
  49.  
  50. print(f'{({"Large": {"Red": 16, "Green": 12, "Yellow": 9}, "Medium": {"Red": 13, "Green": 9, "Yellow": 8}, "Small": {"Red": 9, "Green": 8, "Yellow": 5}}[input()][input()] * int(input()) * 0.65):.2f} leva.')
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement