Advertisement
HristoBaychev

Shopping

Jan 28th, 2023
646
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.  
  3. gpu_want = int(input())
  4. cpu_want = int(input())
  5. ram_want = int(input())
  6.  
  7. price_gpu = gpu_want * 250
  8.  
  9.  
  10. price_cpu = price_gpu * 0.35
  11. total_price_cpu = price_cpu * cpu_want
  12.  
  13.  
  14. price_ram = price_gpu * 0.10
  15. total_price_ram = ram_want * price_ram
  16.  
  17.  
  18. total_sum = price_gpu + total_price_ram + total_price_cpu
  19.  
  20. if gpu_want > cpu_want:
  21.     total_sum = total_sum * 0.85
  22.  
  23. if total_sum <= budget:
  24.     remain_budget = abs(total_sum - budget)
  25.     print(f'You have {remain_budget:.2f} leva left!')
  26. else:
  27.     remain_budget = abs(budget - total_sum)
  28.     print(f'Not enough money! You need {remain_budget:.2f} leva more!')
  29.  
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement