Advertisement
Sichanov

hello france 100

Sep 30th, 2021
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. train_ticket = 150.0
  2. items_to_buy = input()
  3. budget = float(input())
  4. current_budget = budget
  5. items_to_buy = items_to_buy.split("|")
  6.  
  7. current_item = []
  8. profit = 0.0
  9. prices_to_print = ''
  10. for ind in range(len(items_to_buy)):
  11.     current_item = items_to_buy[ind].split('->')
  12.     item_price = float(current_item[1])
  13.     if current_item[0] == "Clothes" and item_price <= 50.00:
  14.         if current_budget >= item_price:
  15.             current_budget -= item_price
  16.             profit += item_price * 0.40
  17.             prices_to_print += f'{item_price * 1.4:.2f} '
  18.     if current_item[0] == "Shoes" and item_price <= 35.00:
  19.         if current_budget >= item_price:
  20.             current_budget -= item_price
  21.             profit += item_price * 0.40
  22.             prices_to_print += f'{item_price * 1.4:.2f} '
  23.     if current_item[0] == "Accessories" and item_price <= 20.50:
  24.         if current_budget >= item_price:
  25.             current_budget -= item_price
  26.             profit += item_price * 0.40
  27.             prices_to_print += f'{item_price * 1.4:.2f} '
  28.  
  29. print(prices_to_print.strip())
  30. print(f"Profit: {profit:.2f}")
  31.  
  32. if budget + profit >= train_ticket:
  33.     print("Hello, France!")
  34. else:
  35.     print("Not enough money.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement