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]
3 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]3 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
The __________ is a worldwide collection of networks that links millions of businesses, govenment agencies, educational institut
Vlad [161]
<span>The INTERNET is a worldwide collection of networks that links millions of businesses, government agencies, educational institutions, and individuals.</span>
5 0
3 years ago
How is geeking out related to the concept of social capital?
vodka [1.7K]

Answer:

It relates to social relationships and social structures. It involves people knowing each other and having positive relationships based on trust, respect, kindness, ect.

Explanation:

3 0
2 years ago
What subnet mask can be used to segment the 172.16.0.0 network to allow for a minimum of 6 subnets while maximizing the number o
marishachu [46]

The subnet mask can be utilized to segment the 172.16.0.0 network to qualify for a minimum of 6 subnets while maximizing the numeral of broadcasters per subnet is 255.255.224.0

<h3>What do subnet masks mean?</h3>
  • A subnet mask is a 32-bit numeral formed by setting keeper bits to all 0s and developing network times to all 1s.
  • In this way, the subnet mask divides the IP speech into the network and host addresses.
  • A subnet mask is used to separate an IP address into two pieces. One element defines the host (computer), and the different part identifies the network to which it belongs.
  • To better comprehend how IP lessons and subnet masks work, look at an IP speech and see how it's managed.

To learn more about  subnet mask, refer to:

brainly.com/question/3234986

#SPJ4

5 0
1 year ago
Urgent. I will mark you brainliest. explain why cyber warfare is a real threat.​
stellarik [79]

Answer: Cyber warfare is a real threat since being able to hack another computer especially a countries computer with lots of info in their weaknesses can lead to their downfall. Since they can even possibly if their skilled enough hack their entire data base system and leak it to the public and that wouldn't be good for them not in a single possible way. That's the reason it's dangerous not only that but also because they can access their servers; which can let them access anything online from the whole country including banking information military info which can let them know which area there gonna go to next equipment there gonna bring and where they're gonna launch missiles, bombs, even nukes if they decide to launch one. And being able to hijack the computer that launches the nukes can make the hacker launch the nuke to a different place or launch the nuke on the country trying to launch the nuke.

Explanation:

3 0
3 years ago
Read 2 more answers
The sum of the deviations of each data value from this measure of central location will always be zero. A. Median B. Standard de
JulijaS [17]

Answer:

C. Mean

Explanation:

Mean = (∑x_{i})/N

Median = central values when data is sorted

Mode = most repeated value

Standard deviation = \sqrt{sum(x_{i}-mean)^{2}/N}

In standard deviation, formula you may see that deviation is being calculated from the mean (central location). But here we take square of the value before adding all of them.

But if we just take sum(x - mean), it would be equal to zero.

<u>EXAMPLE</u>

Take 4, 9, 5 as data

mean = (4+9+5)/3 = 18/3 = 6

sum of deviations from mean = (4-6)+(9-6)+(5-6) = (-2)+(3)+(-1) = 0

8 0
3 years ago
Read 2 more answers
Other questions:
  • Failure to verify information can lead to?
    10·1 answer
  • Which is a function of network media?
    11·2 answers
  • What happens if you give false information on your driver license application?
    12·1 answer
  • Which address correctly represents one that is composed of two halves, one assigned to a network adapter manufacturer, and the o
    6·1 answer
  • 33 points!!!!!!!!!!pls help
    15·1 answer
  • Which of the following are typically an example of primary resources?
    13·1 answer
  • Which function is going to find the lowest value in a range of numbers? MIN MAXAVERAGE COUNT
    5·1 answer
  • When creating envelopes, how will you adjust the layout?
    10·2 answers
  • Frank enters "1" in the field for postal code. What is frank most likely trying to do?
    13·2 answers
  • Which statement is true about the energy of electromagnetic radiation?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!