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
Which value can be entered to cause the following code segment to display the message "That number is acceptable."? ____.
vaieri [72.5K]

Answer:

C) 99

Explanation:

This code only displays "That number is acceptable" when such number is higher than 10 and less than 100. This is  becasue the conditional sentence <em>if </em>controls which message is going to be displayed based on the abovementioned condition. 0 and 10 are not greater than 10, so they don't pass the condition and 100 is not less than itself, so it does not pass either. The only number among the options greater than 10 and less than 100 is 99.

8 0
3 years ago
What is the definition of a flowchart? *
hodyreva [135]

Answer:

A flowchart is simply a graphical representation of steps. It shows steps in sequential order and is widely used in presenting the flow of algorithms, workflow or processes. Typically, a flowchart shows the steps as boxes of various kinds, and their order by connecting them with arrows.

Explanation:

8 0
3 years ago
What would be a good hash code for a vehicle identification that is a string of numbers and letters of the form “9x9xx99x9xx9999
Hunter-Best [27]
I also want to ask a question recently i used a software named [url=http://www.videoconverterfactory.com/tips/youtube-to-flac.html]youtube to flac[/url] while after the conversion the size is to big. Why did this happen and how to solve without lose quality?
4 0
3 years ago
The following types of websites are
zzz [600]
Mmm what are u talking abouy
3 0
3 years ago
A broker statement is an example of an ___ record
VARVARA [1.3K]

Answer: investment

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • How can supply and demand for different careers affect job stability and income?
    6·1 answer
  • The syntax for multiplication function is ____________.
    8·1 answer
  • The TabIndex value assigned to a text box's identifying label must be _______________ for the text box's access key to work corr
    14·1 answer
  • Write a program in java that reads each line in a file, reverses its characters, and writes the resulting line to another file
    15·1 answer
  • Phoebe has to give a permission about recycling. Where should she look while presenting?
    11·1 answer
  • For which type of long-distance call do you need to tell the operator the name of the person to whom you wish to speak?
    10·1 answer
  • You can find synonyms and disciplinary jargon in the ______, _______, and ______ in your search results. You can then use these
    13·1 answer
  • My messaging system is messed up. It keeps saying I'm getting messages but then it says nothing new in my inbox. I'm confused- H
    15·2 answers
  • How many 2/8 pound patties can she make from 7/8 of a pound of hamburger
    10·1 answer
  • Mention and discuss specific professional ethics related to augmented reality, artificial intelligence, and the internet of thin
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!