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]
3 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]3 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
Help!!
Eduardwww [97]

the undo option is the right answer



8 0
3 years ago
Read 2 more answers
The CEO, calls you into her office and tells you that she's learned that the company needs a database to keep track of supplier
k0ka [10]
The database has been a very unique way to park in
7 0
2 years ago
What is peopleware?<br>need help​
Oksana_A [137]

Answer:

Peopleware is a term used to refer to one of the three core aspects of computer technology, the other two being hardware and software.

3 0
3 years ago
1. Given two numbers, n and k ( 0&lt; n, k &lt;=12), generate all the pemutations taking k letters from n letters (nPk) consider
mixer [17]
It is 5jsjsjdhhdhdhdhdhdhdhdhdhd
8 0
3 years ago
Which BEST identifies the primary function of the key words above?
Alchen [17]

Answer:

A. The key words help identify your reading audience.

Explanation:

Through the keyword, you can identify your reading audience. Like, suppose you are writing about Android developers as a keyword. Thus it clarifies that your reading audience will be Android developers mainly. However, the keyword has nothing to do with writing purposes or goals. We first analyze our goal, and then we search for the keyword that can be best for fulfilling our goals. Hence, keywords not in best identify the writing purpose or goal. Like I want to be rich by writing, Now keyword is Android developers, which is confirming that our reading audience will be Android developers mainly, but it does not confirm that we want to be rich, as we might write for charity as well. And keywords does not have anything to do with how much evidence you should cite or the appropriate length of your essay. And hence, A. is the correct option.

3 0
3 years ago
Other questions:
  • What error, if any, is in the following code?
    11·1 answer
  • In modern computer memory, each location is normally composed of one byte.
    7·1 answer
  • Which of the following roles is responsible for writing programming code?
    10·1 answer
  • Why are high-quality transformers wound with large diameter wire?
    8·1 answer
  • Intro to cs 3.7 edhesive g=float(input("Enter your English test grade:")) if(g&lt;=64): print("F") if (g&gt;=65 and g&lt;69): pr
    11·1 answer
  • The code segment below uses the procedure IsPartOf (list, item), which returns true if item appears in list and returns false ot
    13·1 answer
  • I'd like to edit a picture so that I can remove the background behind an object and have it replaced with a transparent backgrou
    13·2 answers
  • What is an Algorithm? (might not be in the chapter text). Give an example.
    13·1 answer
  • You are studying for a test tomorrow. Your friends invite you to
    12·1 answer
  • Impact of information technology in the society​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!