Advertisement
PowerCell46

Hello, France Python

Dec 27th, 2022
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. input_list = (str(input())).split("|")
  2. budget = float(input())
  3.  
  4. list_of_bought_things = []
  5.  
  6.  
  7. for i in range(0, len(input_list)):
  8.     current_input = (input_list[i]).split("->")
  9.     current_type = current_input[0]
  10.     current_price = float(current_input[1])
  11.  
  12.     if current_type == "Clothes":
  13.         if current_price > 50 or current_price > budget:
  14.             continue
  15.         else:
  16.             budget -= current_price
  17.             list_of_bought_things.append(current_price)
  18.  
  19.     elif current_type == "Shoes":
  20.         if current_price > 35 or current_price > budget:
  21.             continue
  22.         else:
  23.             budget -= current_price
  24.             list_of_bought_things.append(current_price)
  25.  
  26.     elif current_type == "Accessories":
  27.         if current_price > 20.50 or current_price > budget:
  28.             continue
  29.         else:
  30.             budget -= current_price
  31.             list_of_bought_things.append(current_price)
  32.  
  33. new_prices_list = []
  34. profit = 0
  35.  
  36. for i in range(0, len(list_of_bought_things)):
  37.     current_bought_price = float(list_of_bought_things[i])
  38.     new_price = current_bought_price + ((current_bought_price / 100) * 40)
  39.     new_prices_list.append(f'{new_price:.2f}')
  40.     profit += (new_price - current_bought_price)
  41.     budget += new_price
  42.  
  43. print(" ".join(new_prices_list))
  44. print(f'Profit: {profit:.2f}')
  45.  
  46. if budget >= 150:
  47.     print("Hello, France!")
  48. else:
  49.     print("Not enough money.")
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement