Advertisement
Nenogzar

Untitled

Nov 5th, 2023
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. items_accessories = input().split("|")
  2. budget = int(input())
  3.  
  4. items_price, budget_left, train_ticket = 0, budget, 150
  5.  
  6. for clean_text in items_accessories:
  7.     type_item, price = (float(x) if x[-1].isdigit() else x for x in clean_text.split('->'))
  8.     if budget_left < price:
  9.         continue
  10.     if any(("Clothes" in type_item and price <= 50,
  11.             "Shoes" in type_item and price <= 35,
  12.             "Accessories" in type_item and price <= 20.50)):
  13.             items_price += price
  14.             budget_left -= price
  15.             print(f'{price * 1.40:.2f}' , end=" ")
  16.  
  17. difference =  items_price * 1.4 - items_price
  18. print(f"\nProfit: {difference:.2f}")
  19.  
  20. if budget + difference > train_ticket:
  21.     print(f"Hello, France!")
  22. else:
  23.     print("Not enough money.")
Tags: hello france
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement