1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
BigorU [14]
4 years ago
7

Take the program written last weekend that creates a deck of cards, shuffles them, and then lists them out. Modify the program t

o 'deal' two hands of cards (two players). Each player will be dealt 5 cards. Deal one to the first player, then one to second player. Repeat until both players have 5 cards in their hand. Then compute the total points in each player's hand and determine the winner with the most points. If a player has an ace, then count that as 11 points. Print out the winning player total points and then his cards. Then print out the losing player total points and his cards. Turn in both your code and a copy of the screen output.
Computers and Technology
1 answer:
Mars2501 [29]4 years ago
8 0

Answer: Here, you might need to make some changes to format it how you'd like, but it gives you the desired output :)

Explanation:

import random as chunky

def play():

   hand1, hand2 = [], []

   for n in range(5):

       hand1.append(chunky.choice(cardList))

       hand2.append(chunky.choice(cardList))

   print("Hand 1: ", end= "")

   for n in hand1:

       print(n, end= " ")

   print()

   print("\nHand 2: ", end= "")

   for n in hand2:

       print(n, end= " ")

   print()

   while "A" in hand1:

       hand1[hand1.index("A")] = 11

   while "A" in hand2:

       hand2[hand2.index("A")] = 11

   print(f"\nHand 1 Total: {sum(hand1)}  Hand 2 Total: {sum(hand2)}")

   print("\nHand 1 WINS!") if sum(hand1) > sum(hand2) else print("\nHand 2 WINS!")

cardList = [1,2,3,4,5,6,7,8,9,10,"A"] #Skipped King, Queen, and Jack. Did not know how to incorperate them

chunky.shuffle(cardList)

looper = True

while looper == True:

   play()

   x = input("\n\nWould you like to go again?(y/n): ")

   if x.lower() == "n":

       quit()

You might be interested in
Who was the first person to develop http the language in which servers and browsers communicate
Rudiy27
The answer would be Tim Berners- lee
6 0
3 years ago
Which options can be adjusted in the print settings?
lutik1710 [3]
You can adjust the number of copies you want, print range (a few pages or all of them), select a printer to print to and preferences that will be unique to your printer model. 
8 0
4 years ago
Read 2 more answers
As the network administrator for a growing company, you’re asked to solve a remote access dilemma. The 12 employees who work fro
Strike441 [17]

Answer:

To provide remote network access to the users to work, the network administrator can use virtual private network (VPN) along with some firewall to protect the system from hackers and other security threats.

Explanation:

Virtual Private Network (VPN) can be used to provide remote access to the users who are currently working from some remote areas. Many companies who have their branches or franchises in different parts of the city uses VPN to connect then all with the company server.

In this way, a firewall has been needed that protect the systems of users as well as company to protect from different security hazards such as hackers, authorization of the users and other security threats.

in this case, 12 em[employees who need remote access to the network can be connected through VPN along with the installation of some suitable firewall.

8 0
4 years ago
Suppose that the performance measure is concerned with just the first T time steps of the environment and ignores everything the
Jobisdone [24]

Answer:

the first T time steps are a factor in the performance measure. So for instance, if the environment is in state A at time step 1, the performance measure can be different than being in state A at step 2 since the state of the environment in step 1 is relevant to the performance measure in the latter case. Thus as the performance measures can be different, the rational agent may make different actions.

3 0
3 years ago
. Convert your age into binary and then to hexadecimal. Show your work.
Dovator [93]

Explanation:

Age = 23.

To convert a base 10 number to hexadecimal number we have to repeatedly divide the decimal number by 16 until  it becomes zero and store the remainder in the reverse direction of obtaining them.

23/16=1 remainder = 5

1/16=0 remainder = 1

Now writing the remainders in reverse direction that is 15.

My age in hexadecimal number is (15)₁₆.

5 0
4 years ago
Other questions:
  • Using the CPI to calculate the inflation rate​ _______________ the underlying inflation​ rate, and using the core inflation rate
    7·2 answers
  • What component of a computer system holds the operating system when the computer is not running
    6·2 answers
  • What is the purpose of filters in a database?
    15·1 answer
  • Four parts of the compuet mouse​
    6·1 answer
  • PLZZZ HELP ME THIS IS THE THIRD TIME!!! BRAINLIEST AND 50 POINTS What are the advantages and disadvantages of top-down and botto
    9·1 answer
  • If you enter 234.567 into a cell that is formatted to display 1 decimal place, what is the value stored in the cell?
    13·1 answer
  • Byron wants to use Quick Parts to insert reusable content into a company Word document. Where will he access this option? Design
    11·2 answers
  • Create two Lists, one is ArrayList and the other one is LinkedList and fill it using 10 state names (e.g., Texas). Sort the list
    6·1 answer
  • Denise found a volume of documents in the trash bin that contained individuals, names, social security numbers and years of birt
    14·1 answer
  • Trying to make the baseplate red and turn off can collide then the game waits 5 seconds and turns on can collide, making the bas
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!