Advertisement
veronikaaa86

07. Shopping

Jul 9th, 2023
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. budget = float(input())
  2. video_count = int(input())
  3. cpu_count = int(input())
  4. ram_count = int(input())
  5.  
  6. video_sum = video_count * 250
  7. cpu_sum = cpu_count * (video_sum * 0.35)
  8. ram_sum = ram_count * (video_sum * 0.1)
  9.  
  10. total_sum = video_sum + cpu_sum + ram_sum
  11.  
  12. if video_count > cpu_count:
  13.     total_sum = total_sum * 0.85
  14.  
  15. diff = abs(total_sum - budget)
  16. if budget >= total_sum:
  17.     print(f"You have {diff:.2f} leva left!")
  18. else:
  19.     print(f"Not enough money! You need {diff:.2f} leva more!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement