Advertisement
Spocoman

05. Faro Shuffle

Jan 23rd, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. cards = input().split()
  2. faro_shuffling = int(input())
  3.  
  4. for i in range(faro_shuffling):
  5.     left = []
  6.     right = []
  7.     for j in range(1, len(cards) // 2):
  8.         left.append(cards[j])
  9.         right.append(cards[j + len(cards) // 2 - 1])
  10.     for k in range(1, len(cards) - 1, 2):
  11.         cards[k] = right[ k // 2]
  12.         cards[k + 1] = left[k // 2]
  13.  
  14. print(cards)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement