bl00dt3ars

Untitled

Jul 13th, 2021
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. cards = input().split(":")
  2. new_deck = []
  3. command = input().split()
  4.  
  5. while not command[0] == "Ready":
  6.     if command[0] == "Add":
  7.         if command[1] not in cards:
  8.             print("Card not found.")
  9.         else:
  10.             new_deck.append(command[1])
  11.     elif command[0] == "Insert":
  12.         if 0 <= int(command[2]) < len(new_deck) and command[1] in cards:
  13.             new_deck.insert(int(command[2]), command[1])
  14.         else:
  15.             print("Error!")
  16.     elif command[0] == "Remove":
  17.         if command[1] in new_deck:
  18.             new_deck.remove(command[1])
  19.         else:
  20.             print("Card not found.")
  21.     elif command[0] == "Swap":
  22.         first_card = new_deck.index(command[1])
  23.         second_card = new_deck.index(command[2])
  24.         new_deck[first_card], new_deck[second_card] = new_deck[second_card], new_deck[first_card]
  25.     elif command[0] == "Shuffle":
  26.         new_deck = list(reversed(new_deck))
  27.     command = input().split()
  28.  
  29. print(" ".join(new_deck))
Advertisement
Add Comment
Please, Sign In to add comment