DiYane

Faro Shuffle

Jul 31st, 2023
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. card_deck = input().split()
  2. num_of_shuffles = int(input())
  3. final_deck = []
  4.  
  5. for shuffles in range (num_of_shuffles):
  6.     final_deck = []
  7.     middle_of_the_desk = len(card_deck) // 2
  8.     left_half = card_deck [0:middle_of_the_desk]
  9.     right_half = card_deck [middle_of_the_desk::]
  10.     for index_of_the_card in range(len(left_half)):
  11.         final_deck.append(left_half[index_of_the_card])
  12.         final_deck.append(right_half[index_of_the_card])
  13.  
  14.     card_deck = final_deck
  15. print(card_deck)
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment