Sichanov

shopping

Oct 3rd, 2021
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. budget = float(input())
  2. number_videocards = int(input())
  3. number_processors = int(input())
  4. number_ram = int(input())
  5.  
  6. price_videocard = number_videocards * 250
  7. price_processor = price_videocard * 0.35
  8. price_ram = price_videocard * 0.1
  9.  
  10. total_costs = price_videocard + number_processors * price_processor + number_ram * price_ram
  11. discount = 0
  12.  
  13. if number_videocards > number_processors:
  14.     discount = total_costs * 0.15
  15.  
  16. total_sum = total_costs - discount
  17. difference = abs(budget - total_sum)
  18.  
  19. if budget >= total_sum:
  20.     print(f"You have {difference:.2f} leva left!")
  21. else:
  22.     print(f"Not enough money! You need {difference:.2f} leva more!")
Advertisement
Add Comment
Please, Sign In to add comment