Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cards = input().split(":")
- new_deck = []
- token = input()
- while not token == "Ready":
- token = token.split(" ")
- command = token[0]
- if command == "Add":
- current_card = token[1]
- if current_card in cards:
- new_deck.append(current_card)
- else:
- print("Card not found.")
- elif command == "Insert":
- current_card = token[1]
- index = int(token[2])
- if current_card in cards:
- if 0 <= index < len(new_deck):
- new_deck.insert(index, current_card)
- else:
- print("Error!")
- elif command == "Remove":
- current_card = token[1]
- if current_card in new_deck:
- new_deck.remove(current_card)
- else:
- print("Card not found.")
- elif command == "Swap":
- first_card = token[1]
- second_card = token[2]
- a, b = new_deck.index(first_card), new_deck.index(second_card)
- new_deck[a], new_deck[b] = new_deck[b], new_deck[a]
- elif "Shuffle" in command:
- new_deck = new_deck[::-1]
- token = input()
- print(" ".join(new_deck))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement