answer.
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
Assoli18 [71]
1 year ago
9

Python

Computers and Technology
1 answer:
Sergio039 [100]1 year ago
8 0

Answer:

Check the explanation

Explanation:

from random import randint

def startGame(round,p1Name,p2Name,p1Wins,p2Wins):

print("\nPlaying round", round ,"of Beat That...")

print(p1Name,"rolls")

p1 = rollDice(p1Name)

print(p2Name,"rolls")

p2 = rollDice(p2Name)

if p1 > p2:

print(p1Name,"Wins this Round!")

p1Wins += 1

elif p2 > p1:

print(p2Name,"Wins this Round!")

p2Wins +=1

else:

print("The Players Tie this Round")

return p1Wins,p2Wins

def maxNumber(num):

a = []

for i in range(len(num)):

a.append(max(num))

num.remove(max(num))

maxNum = ''.join(map(str,a))

return maxNum

def getDiceRollValue(numOfDice):

num = []

for i in range(numOfDice):

a = randint(1, 6)

num.append(a)

return num

def rollDice(playerName):

rollValue = getDiceRollValue(numOfDice)

print(rollValue)

maxNumOutofRoll = maxNumber(rollValue)

print(playerName, "chooses",maxNumOutofRoll)

return maxNumOutofRoll

def winner(p1Name,p2Name,p1Wins,p2Wins):

print("Game Score:",p1Name,"has won",p1Wins,"rounds.",p2Name,"has won",p2Wins,"rounds.")

if p1Wins > p2Wins:

print(p1Name,"Wins This Game!")

elif p2Wins > p1Wins:

print(p2Name,"Wins This Game!")

else:

print("The Players Tie the Game")

numOfDice = 2

numOfRounds = 5

p1Name = "Player 1"

p2Name = "Player 2"

p1Wins = 0

p2Wins = 0

for i in range(1,numOfRounds+1):

p1Wins,p2Wins = startGame(i,p1Name,p2Name,p1Wins,p2Wins)

winner(p1Name,p2Name,p1Wins,p2Wins)

You might be interested in
A user called to inform you that the laptop she purchased yesterday is malfunctioning and will not connect to her wireless netwo
kakasveta [241]

Answer:

You can perform the following two steps

Explanation:

  1. Have the user press the appropriate function key combination to enable the wireless radio and then attempt to connect to the wireless network (since by mistake he could have disabled it).
  2. Ask the user to turn on the laptop’s airplane mode and attempt to reconnect to the wireless network (this mode basically what it does is disable adapters and activate it will connect the Wi-Fi network).
7 0
1 year ago
Suppose that the data mining task is to cluster points (with (x, y) representing location) into three clusters, where the points
solong [7]

Answer:

Explanation:

K- is the working procedure:

It takes n no. of predefined cluster as input and data points.

It also randomly initiate n centers of the clusters.

In this case the initial centers are given.

Steps you can follow

Step 1. Find distance of each data points from each centers.

Step 2. Assign each data point to the cluster with whose center is nearest to this data point.

Step 3. After assigning all data points calculate center of the cluster by taking mean of data points in cluster.

repeat above steps until the center in previous iteration and next iteration become same.

A1(4,8), A2(2, 4), A3(1, 7), B1(5, 4), B2(5,7), B3(6, 6), C1(3, 7), C2(7,8)

Centers are X1=A1, X2=B1, X3=C1

A1 will be assigned to cluster1, B1 will be assigned to cluster2 ,C1 will be assigned to cluster3.

Go through the attachment for the solution.

5 0
2 years ago
Which of the following represent features of free software licensing? Check all of the boxes that apply.
Iteru [2.4K]

Answer: A :is concerned with defending users’ freedom of use

C:makes source code available for editing

Explanation:

7 0
1 year ago
_____________ helps to control and limit the number of consecutive request failures that cross a threshold. Review breaker Micro
True [87]

Answer:

Circuit breaker

Explanation:

Circuit breaker -

It is a type of electrical switch , whose main function is to protect the electrical circuit by the process of short circuit or overloading , is referred to as a circuit breaker .

The circuit breaker , as the name suggests , disrupts the circuit as soon as there is the condition of overloading or short circuit , and thereby saves the appliances .

Hence , from the given information of the question,

The correct term is circuit breaker  .

5 0
2 years ago
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject afte
Marina86 [1]
The correct answer for this question is this one: "She can rename the 2 worksheet by right clicking the sheet tab. After right clicking the mouse, select Rename Sheet and type the preferred name of the sheet."  Hope this helps answer your question and have a nice day ahead.
5 0
2 years ago
Read 2 more answers
Other questions:
  • CAPTCHAs can be used as a form of signature to create a valid contract in e-commerce. True False
    6·2 answers
  • Which statement regarding dialogues in multiplayer games is true? Dialogues are based only on players’ actions.
    7·2 answers
  • Whoever helps me with these questions i will help them with the same number of questions in any subject: 1. As the operations ma
    14·1 answer
  • You buy a $3,500 car and finance it through the car dealer. the contract says if you are two months delinquent with your payment
    9·1 answer
  • Using information from the lesson, explain how new technologies change your experience as a consumer.
    5·2 answers
  • If the computer has an encrypted drive, a ____ acquisition is done if the password or passphrase is available. a. passive b. sta
    8·1 answer
  • Suppose that you need to maintain a collection of data whose contents are fixed- i.e., you need to search for and retrieve exist
    8·1 answer
  • The major result of treating 1-butyne with 6M aqueous NaOH would be:_______.A. the production of an alkene.B. the production of
    10·1 answer
  • Write a function string middle(string str) that returns a string containing the middle character in str if the length of str is
    13·1 answer
  • Lin is booting up his computer, and during the boot process, the computer powers down. After several unsuccessful attempts to bo
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!