Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cards = input().split(":")
- line = input().split()
- while line[0] != "Ready":
- command = line[0]
- if command == "Add":
- card = line[1]
- if card in cards:
- cards.remove(card)
- cards.append(card)
- else:
- print("Card not found.")
- elif command == "Insert":
- card = line[1]
- index = int(line[2])
- new_place = card
- if card in cards:
- if index in range(len(cards)):
- cards.remove(card)
- cards.insert(index, new_place)
- else:
- print("Error!")
- elif command == "Remove":
- card = line[1]
- if card in cards:
- cards.remove(card)
- else:
- print("Card not found.")
- elif command == "Swap":
- card_1 = line[1]
- card_2 = line[2]
- card_1_1 = cards.index(card_1)
- card_2_2 = cards.index(card_2)
- cards[card_1_1], cards[card_2_2] = cards[card_2_2], cards[card_1_1]
- elif command == "Shuffle":
- if line[1] == "deck":
- cards.reverse()
- line = input().split()
- print(" ".join(cards))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement