Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list_products = input().split('!')
- command = input()
- while command != "Go Shopping!":
- tokens = command.split(' ')
- command = tokens[0]
- product = tokens[1]
- if command == "Urgent" and product not in list_products:
- list_products.insert(0, product)
- elif command == "Unnecessary" and product in list_products:
- list_products.remove(product)
- elif command == "Correct" and product in list_products:
- new_product = tokens[2]
- list_products[list_products.index(product)] = new_product
- elif command == "Rearrange" and product in list_products:
- list_products.append(list_products.pop(list_products.index(product)))
- command = input()
- print(", ".join(list_products))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement