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
____ [38]
2 years ago
11

Write a function called play_round that simulates two people drawing cards and comparing their values. High card wins. In the ca

se of a tie, draw more cards. Repeat until someone wins the round. The function has two parameters: the name of player 1 and the name of player 2. It returns a string with format ' wins!'. For instance, if the winning player is named Rocket, return 'Rocket wins!'.
Computers and Technology
1 answer:
elena-s [515]2 years ago
8 0

Answer:

Here you go, Change it however you'd like :)

Explanation:

import random as r

def play_round(p1, p2):

   cards = [1,2,3,4,5,6,7,8,9,10,"J","Q","K","A"]

   play1 = r.choice(cards)

   play2 = r.choice(cards)

   

   while play1 == play2:

       play1 = r.choice(cards)

       play2 = r.choice(cards)

   

   if cards.index(play1) > cards.index(play2):

       return f"{p1}'s Card: {play1}\n{p2}'s Card: {play2}\nThe Winner is {p1}"

   else:

       return f"{p1}'s Card: {play1}\n{p2}'s Card: {play2}\nThe Winner is {p2}"

print(play_round("Bob","Joe"))

You might be interested in
A newspaper publishes a negative editorial on how local politicians are dragging their feet in building a new bridge. Select the
jeka57 [31]
Your answer would be
A. The editorial is data.
I just took this test :)
6 0
3 years ago
Read 2 more answers
What are the other number systems? and how to convert binary numbers to their decimal equivalent.?
Mrrafil [7]
In computers we use: decimal constantly, hexadecimal daily, octal weekly and binary monthly.  Decimal is base 10, hexadecimal is base 16, octal is base 8 and binary is base 2.

To convert binary to decimal, simply add the magnitudes of the digits that are set.
7 0
2 years ago
Although there are three well-known operating systems, the most common are Microsoft Windows and Mac OS. Discuss the similaritie
tiny-mole [99]

Answer:

There are very few similarities beyond some convergent features of their respective user interfaces. Their internal architecture is very different, differing from kernel models to shell integration to executable formats. A comprehensive list of similarities is neither possible nor useful, because it would consist mostly of obvious statements like "They are both operating systems" or "They both have graphical user interfaces, "They both include

Explanation:

How's that?

7 0
2 years ago
What filter would only include data from a campaign titled back to school in campaign reports?.
Mkey [24]

Answer:

Custom Include filter with field "Campaign Name" and pattern "back to school"

Explanation:

6 0
2 years ago
In project management, which step involves the project manager identifying
nasty-shy [4]

Answer: The only help is your lord and savior Jesus Christ Amen YAR

Explanation: The Bible or Church

8 0
2 years ago
Other questions:
  • Blank text has a darker apperance than normal texts
    8·1 answer
  • What types of storage can be used to access your data on another computer?
    6·2 answers
  • What is infinite recursion?
    7·1 answer
  • i need to also do a algorithm where if the total is a even number 10 points are added to the score and if the total is odd then
    11·1 answer
  • Which of the following statements is CORRECT? a. Multiple IRRs can occur only if the signs of the cash flows change more than on
    12·1 answer
  • Assignment 4: Evens and Odds<br><br><br> How do I fix this?
    13·1 answer
  • JAVA
    5·1 answer
  • According to programming best practices, how should you handle code that needs to be repeated several times in a program?
    6·1 answer
  • Identify when programmers use an Else statement.
    15·2 answers
  • The idea that an object can exist separate from the executing program that creates it is called
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!