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]
2 years ago
9

Python

Computers and Technology
1 answer:
Sergio039 [100]2 years 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
If there are 8 opcodes and 10 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the
Nimfa-mama [501]

Answer:  

For 32 bits Instruction Format:

OPCODE   DR               SR1                   SR2      Unused bits

a) Minimum number of bits required to represent the OPCODE = 3 bits

There are 8 opcodes. Patterns required for these opcodes must be unique. For this purpose, take log base 2 of 8 and then ceil the result.

Ceil (log2 (8)) = 3

b) Minimum number of bits For Destination Register(DR) = 4 bits

There are 10 registers. For unique register values take log base 2 of 10 and then ceil the value.  4 bits are required for each register. Hence, DR, SR1 and SR2 all require 12 bits in all.  

Ceil (log2 (10)) = 4

c) Maximum number of UNUSED bits in Instruction encoding = 17 bits

Total number of bits used = bits used for registers + bits used for OPCODE  

     = 12 + 3 = 15  

Total  number of bits for instruction format = 32  

Maximum  No. of Unused bits = 32 – 15 = 17 bits  

OPCODE                DR              SR1             SR2              Unused bits

  3 bits              4 bits          4 bits           4 bits                17 bits

7 0
2 years ago
What does a sticky CTA do?
Anarel [89]
It encourages users to revisit your website.
5 0
1 year ago
Read 2 more answers
Float_abs - return bit-level equivalent of absolute value of f for * floating point argument f. * both the argument and result a
olga_2 [115]

#include <stdio.h>

int main(void) {

            // your code goes here

            //unsigned a =float_times_four(0x80000000);

            unsigned float_times_four(unsigned uf){

                unsigned expn = (uf >> 23) & 0xFF;

                printf(expn);

                unsigned sign = uf & 0x80000000;

                unsigned frac = uf & 0x007FFFFF;

                if(expn == 255 ||(expn == 0 && frac ==0))

                    return uf;

                if(expn){

                    expn<<2;

                }else if(frac == 0x007FFFFF){

//here 0x7FFFFF given by you that is wrong you place this 0x007FFFFF will excute

                    frac>>2;

                    expn<<2;

                }else{

                    frac<<=2;

                }

return (sign) | (expn <<23) | (frac);

            }

            return 0;

}

3 0
2 years ago
Wesley has to create a web banner to announce a “Back to School” sale by an online retailer. Which information should he determi
olganol [36]
I would say A :)))))))
4 0
2 years ago
Read 2 more answers
You can apply several different worksheet themes from which tab?
Lemur [1.5K]
<span>D. Page Layout  i hope this helps </span>
8 0
2 years ago
Read 2 more answers
Other questions:
  • Match each function with its possible output.
    7·2 answers
  • Julie is working on a spreadsheet with data about the company's profits. They will be sharing this data with customers. She chec
    6·2 answers
  • Consider a maximal flow problem in which vehicle traffic entering a city is routed among several routes before eventually leavin
    7·1 answer
  • To use the Web, each client computer requires a data link layer software package called a Web browser. True False
    8·1 answer
  • A restaurant has a case type that allows customer to book the dining room for events. Customers provide basic information includ
    11·1 answer
  • in a small office, there are 5 computers, a network printer, and a broadband connection to the internet. what devices are needed
    9·1 answer
  • 12) Suppose you wanted a subroutine to return to an address that was 3 bytes higher in memory than the return address currently
    11·1 answer
  • Earlier in the day, you created a user account for Brenda Cassini (bcassini). When she tries to log in, she can't. You realize t
    9·2 answers
  • Assume your friend just sent you 32 bits of pixel data (just the 0s and 1s for black and white pixels) that were encoded after s
    14·1 answer
  • When drivers have no control over their driving environment and are stuck in traffic, the lack of control over the traffic event
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!