python - Appending a list which refers to a list inside a function -


I have the task of preparing a blackjack game in Python, allowing 4 human players to play automatic houses simultaneously. gives. / P>

I have to use a function 'get_deck' (see code below). I am struggling to get a card from 'get_deck' and add it to the player list. I used to manage the program while using my own defined list for the card, but for this assignment, I have to use the 'get_deck' function. '?????' In the code given below, where I have referenced my first card value list.

This is my code:

  def get_deck (): deck = [value + value for suit 'SHDC' for the suit '23456789 TJQA'] random. (Deck) return IAR (deck), while correct: get_deck () player1 = [] player 2 = [] player3 = [] player4 = [] home = [] player1.append (Random.choice (?????) ) Player2.append (random.choice (?????)) player3.append (random.choice (?????)) player4.append (random.choice (?????)) house.append ( Random.choice (?????)) player1_bust = wrong player 2_bust = wrong player 3_bust = wrong player 4_bust = wrong house_bust = wrong_number = 1] == 1: player1_total = total (player 1) while correct: player 1_total = Total (player 1) With Rint "Player 1 Total value of% d These cards% s." Player (player 1, player1_tuyl) if player 1_total & gt; 21: Print "Bust!" Player1_bust = True Break Elif Player 1_total == 21: Print "Blackjack!" Hit_Stand: Player 1.append (random.choice (?????)) Other: Break   

I hope this makes sense! thank you in advanced.

Using Python 2.7

get_deck function first Randomly altering the deck for you. You do not need to get a random element in your list, because it is already random. Just get the next element from that element that get_deck returns


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -