Question: Complete the following functions and use them to complete the program so that is allows to people at the same keyboard to play a game

Complete the following functions and use them to complete the program so that is allows to people at the same keyboard to play a game of Rack-O.
def get_rack(deck, rack_size):
Deal the top rack_size cards (first rack_size elements of the list) of the deck into a new rack. We expect rack_size to be between 5 and 10. The first card goes in the first slot, the second card goes in the second slot, and so forth. We assume len(deck)>= rack_size. Return the list of ints representing the rack.. deck is a list of ints and rack_size is an int between 5 and 10 inclusive.
def take_turn(deck, discard, player_rack):
Take the player's turn. Give them the choice of drawing or taking the top card of the discard pile. If they draw they can replace a card or discard the draw. If they take the top card of the discard pile they must replace a card in their rack.
The parameter deck is a list of int represented the deck, discard is a list of ints representing the discard pile, and player_rack is a list of ints representing a player's rack
def place_card(player_rack, new_card, discard):
Ask the player which card to replace in their rack. Replace it with the given new card. Place the card removed from the player's rack at the top of the discard pile. Error checks until player enters a card that is currently in their rack.
The parameter player_rack is a list of ints representing the player's rack of cards, new_card is an it, and discard is a list of ints representing the discard pile
def is_sorted(rack):
Return True if this rack is sorted in ascending order, False otherwise. Do not create any new lists in this function. This means you are not to call the built in sorted function which creates a new list when called. The parameter rack is a list of ints

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!