desislava_topuzakova

04. Series

Mar 20th, 2021
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. budget = float(input())
  2. count_series = int(input())
  3.  
  4. # за всеки сериал:
  5.     # име
  6.     # цена
  7.     # проверка дали има отстъпка
  8.     # добавяме цената към общата сума
  9.  
  10. # проверка дали бюджетът ми покрива сумата за филмите
  11. spend_money = 0
  12.  
  13. for serial in range(1, count_series + 1):
  14.     name = input()
  15.     price = float(input())
  16.     if name == 'Thrones':
  17.         price = price - 0.50 * price
  18.         # price = 0.50 * price
  19.     elif name == 'Lucifer':
  20.         price = price - 0.40 * price
  21.         # price = 0.60 * price
  22.     elif name == 'Protector':
  23.         price = price - 0.30 * price
  24.         # price = 0.70 * price
  25.     elif name == 'TotalDrama':
  26.         price = price - 0.20 * price
  27.         # price = 0.80 * price
  28.     elif name == 'Area':
  29.         price = price - 0.10 * price
  30.  
  31.     spend_money += price
  32.  
  33. # проверка дали парите стигат
  34. if budget >= spend_money:
  35.     left_money = budget - spend_money
  36.     print(f'You bought all the series and left with {left_money:.2f} lv.')
  37. else:
  38.     need_money = spend_money - budget
  39.     print(f'You need {need_money:.2f} lv. more to buy the series!')
Advertisement
Add Comment
Please, Sign In to add comment