| about | help | code help+videos | done | prefs |
perfect_shuffle
A "perfect shuffle" is when you take a deck of cards, cut them exactly in half, and then shuffle them so that the top card is the top card from the top half, the second card is the top card from the bottom half, the third is the second card from the top half, and they alternate all the way through. Define perfect_shuffle(deck) that takes a list as input (guaranteed to have an even number of elements) and returns a perfect shuffle of the list. perfect_shuffle([1, 2, 3, 4, 5, 6]) → [1, 4, 2, 5, 3, 6] perfect_shuffle([]) → [] perfect_shuffle([1, 2]) → [1, 2] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220 Post-solution available
Copyright Nick Parlante 2017 - privacy