β back to unit
Medium
# queues medium
The Card Draw Choice
House rules: each draw may take the TOP card or the BOTTOM card of the deck. Grandma always knows which. π΄
You get the deck (top first) and the draws β a list of top / bottom (never more draws than cards). Print the drawn cards in draw order, space-separated.
Example:
Input: deck = ["ace", "king", "queen", "jack", "ten"], draws = ["top", "bottom", "top"]
Output: ace ten king
top takes ace (the front), bottom takes ten (the back), then top takes king (the new front).
π‘ need a hint?
q-card-draw-choice.pyπ given lines are locked β write your code in between
loading...