desislava_topuzakova

05. Small Shop

Oct 21st, 2020
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. # 1. read input -> product, city, quantity
  2. # 2. product и city -> ед. цена на продукта
  3. # 3. print крайна цена -> quantity * ед. цена на продукта
  4.  
  5. product = input()
  6. city = input()
  7. quantity = float(input())
  8. price = 0 # ед. цена за продукта
  9.  
  10. if city == 'Sofia':
  11.     # products
  12.     if product == 'coffee':
  13.         price = 0.50
  14.     elif product == 'water':
  15.         price = 0.80
  16.     elif product == 'beer':
  17.         price = 1.20
  18.     elif product == 'sweets':
  19.         price = 1.45
  20.     elif product == 'peanuts':
  21.         price = 1.60
  22. elif city == 'Plovdiv':
  23.     # products
  24.     if product == 'coffee':
  25.         price = 0.40
  26.     elif product == 'water':
  27.         price = 0.70
  28.     elif product == 'beer':
  29.         price = 1.15
  30.     elif product == 'sweets':
  31.         price = 1.30
  32.     elif product == 'peanuts':
  33.         price = 1.50
  34. elif city == 'Varna':
  35.     # products
  36.     if product == 'coffee':
  37.         price = 0.45
  38.     elif product == 'water':
  39.         price = 0.70
  40.     elif product == 'beer':
  41.         price = 1.10
  42.     elif product == 'sweets':
  43.         price = 1.35
  44.     elif product == 'peanuts':
  45.         price = 1.55
  46.  
  47. # знаем ед. цена за продукт спрямо града
  48. print(quantity * price)
Add Comment
Please, Sign In to add comment