Advertisement
Nenogzar

Untitled

Nov 5th, 2023
895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. items_accessories = input().split("|")
  2. budget = int(input())
  3.  
  4. items_price = list()
  5. budget_left = budget
  6. selling_items = list()
  7. train_ticket = 150
  8.  
  9. for clean_text in items_accessories:
  10.     if "Clothes->" in clean_text:
  11.         text = float(clean_text.replace("Clothes->", ""))
  12.  
  13.         if 0 < text <= 50 and budget_left >= text:
  14.             items_price.append(text)
  15.             budget_left -= text
  16.             selling_items.append(text + text * 0.40)
  17.  
  18.     elif "Shoes->" in clean_text:
  19.         text = float(clean_text.replace("Shoes->", ""))
  20.  
  21.         if 0 < text <= 35 and budget_left >= text:
  22.             items_price.append(text)
  23.             budget_left -= text
  24.             selling_items.append(text + text * 0.40)
  25.  
  26.     elif "Accessories->" in clean_text:
  27.         text = float(clean_text.replace("Accessories->", ""))
  28.  
  29.         if 0 < text < 20.50 and budget_left >= text:
  30.             items_price.append(text)
  31.             budget_left -= text
  32.             selling_items.append(text + text * 0.40)
  33.  
  34. for n in selling_items:
  35.     print(f"{n:.2f}", end=" ")
  36.  
  37. normal_price = sum(items_price)
  38. re_sale = sum(selling_items)
  39. difference = re_sale - normal_price
  40.  
  41. print(f"\nProfit: {difference:.2f}")
  42.  
  43. if budget + difference > train_ticket:
  44.     print(f"Hello, France!")
  45. else:
  46.     print("Not enough money.")
Tags: france
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement