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