Advertisement
horozov86

Untitled

Jan 31st, 2023
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. collection_items = input().split("|")
  2. budget = float(input())
  3. ticket_price = 150
  4. initial_budget = budget
  5.  
  6. total_earned_money = 0
  7. earned_money = []
  8. for item in collection_items:
  9.     item_arg = item.split("->")
  10.     item_name = item_arg[0]
  11.     item_price = float(item_arg[1])
  12.  
  13.     if item_name == "Clothes" and item_price > 50:
  14.         continue
  15.  
  16.     if item_name == "Shoes" and item_price > 35:
  17.         continue
  18.  
  19.     if item_name == "Accessories" and item_price > 20.50:
  20.         continue
  21.  
  22.     budget -= item_price
  23.     sell_price = (item_price * 1.4)
  24.     earned_money.append(f"{sell_price:.2f}")
  25.     total_earned_money += sell_price
  26.  
  27.     if budget < item_price:
  28.         break
  29.  
  30. final_money = " ".join(earned_money)
  31. profit = total_earned_money + budget - initial_budget
  32.  
  33. print(final_money)
  34. print(f"Profit: {profit:.2f}")
  35. if total_earned_money + budget >= ticket_price:
  36.     print("Hello, France!")
  37. else:
  38.     print("Not enough money.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement