Advertisement
dkyoseff

Conditional Statements - Exercise / 07. Shopping

Jul 12th, 2022
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. budget = float(input())
  2. video_cards = int(input())
  3. processors = int(input())
  4. ram = int(input())
  5.  
  6. price_video = 250 * video_cards
  7. price_processor = ((price_video * 35) / 100) * processors
  8. price_ram = ((price_video * 10) / 100) * ram
  9.  
  10. sum = price_video + price_processor + price_ram
  11.  
  12. if video_cards >= processors:
  13.     sum = sum - ((sum * 15)/100)
  14.  
  15. if sum <= budget:
  16.     sum_left = budget - sum
  17.     print(f'You have {sum_left:.2f} leva left!')
  18. else:
  19.     sum_left2 = sum - budget
  20.     print(f'Not enough money! You need {sum_left2:.2f} leva more!')
  21.  
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement