Advertisement
AntonStanoev

Shopping

Nov 17th, 2022 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 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_videocards = number_videocards * 250
  7. price_processors = number_processors * (price_videocards * 0.35)
  8. price_ram = number_ram * (price_videocards * 0.10)
  9.  
  10. total_price = price_ram + price_processors + price_videocards
  11.  
  12. if number_videocards > number_processors:
  13.     total_price -= total_price * 0.15
  14. else:
  15.     pass
  16.  
  17. if total_price < budget:
  18.     money_left = budget - total_price
  19.     print(f'You have {money_left:.2f} leva left!')
  20. else:
  21.     money_needed = total_price - budget
  22.     print(f'Not enough money! You need {money_needed:.2f} leva more!')
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement