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
soldier1979 [14.2K]
3 years ago
14

Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the

message "player1 wins" is printed to standard out. When score2 exceeds score1, the message "player2 wins" is printed to standard out. In each case, the variables player1Wins,, player1Losses, player2Wins, and player2Losses,, are incremented when appropriate.
Finally, in the event of a tie, the message "tie" is printed and the variable tieCount is incremented.
So far this is what I have:
if score1>score2:
player1Wins=player1Wins+1
player2Losses=player2Losses+1
print("player1Wins")
elif score2>score1
player2Wins=player2Wins+1
player1Losses=player1Losses+1
print("player2Wins")
else:
score1=score2
tieCount=tieCount+1
print("tie")
___________________________
However, I'm still getting an error and not sure why. Am I indenting something wrong?
Computers and Technology
1 answer:
vaieri [72.5K]3 years ago
8 0

Answer:

player1Wins = player1Losses = player2Wins = player2Losses = tieCount = 0

score1 = 10

score2 = 10

if score1>score2:

   player1Wins=player1Wins+1

   player2Losses=player2Losses+1

   print("player1 wins")

elif score2>score1:

   player2Wins=player2Wins+1

   player1Losses=player1Losses+1

   print("player2 wins")

else:

   tieCount=tieCount+1

   print("tie")

Explanation:

Since your indentation can not be understand what you give us, please try to do it as you see in the answer part.

Although it seems that this is a part of the code, it is normal that you get errors. However, since you keep track of the variables, it is better to initialize the variables that will keep the counts. Since initially, they are 0, you may set them as 0. Also, if you assign the values to the scores, probably you would not get any error. This way, you may test your code as I did.

Other than these, in the else part you do not need to write "score1=score2", because if score1 is not greater than score2 and if score2 is not greater than score1, this already implies that they are equal

You might be interested in
A group of accountants encrypt the emails they send to your company because they contain highly sensitive financial information.
ratelena [41]

Answer:

a) Generate a new public and private key

Explanation:

You encrypt a message using the recipient's public key and the recipient decrypts the message using his own private key. Only the public key can be known by an external agent. The private key is for the individual and is not expected to be shared. In the event that the recipient cannot decrypt the message, it is unsafe to send one's private key to him. He does not even need one's private key to decrypt the message, he needs his own private key.

The best thing to do is to generate another means of security by generating new public and private key so that the sender encrypts the message with the new public key and the receiver decrypts it using his new private key.

Option B is wrong because, if the encryption is removed, the aim, which is to secure the message from intruders is not achieved.

8 0
3 years ago
In workstation domain policies, _________________ provide the specific technology requirements for each device. IT staff uses re
Snezhnost [94]

Answer:

The correct word for the blank space is: baseline standards.

Explanation:

Minimum Baseline Standards (MBS) refers to the minimum security guidelines companies set to protect their sensitive data. To achieve such objective, all the devices of an entity -<em>e.g.: servers, routers, and firewalls</em>- must be configured in a form that prevents external or internal attacks. Setting an MBS helps an organization to provide technical support faster since regular users will be working with a system that was implemented by the <em>Information Technology</em> (IT) department of the same association.

6 0
3 years ago
ven int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 5
monitta

Answer:

Following are statement is given below

int  k=1,total=0; // variable declaration

while(k<50) // iterating the while loop

{

   total=total+k*k;//  calculating the square

   k=k+1; // increments the value of k by 1    

}

Explanation:

Following are the description of Statement.

  • Declared a variable "total" and "k" of the "integer " type initialized the total to 0 and "k" to 1.
  • Iterating the while loop for less then 50 .In this loop, we calculating the sum of square of first 50 number in the "total" variable .
  • After that increment the value of "k" variable by 1 to execute the loop less then 50 .

3 0
3 years ago
Write a function transpose(matrix) that returns the transpose of the input matrix, which is represented as a list of lists. Reca
mariarad [96]

Answer:you eat

Explanation:yea

4 0
2 years ago
Ark titanoboa taming
ivann1987 [24]
Huh???????................
3 0
3 years ago
Other questions:
  • Clifford created a table using OpenOffice Writer and entered some information into the table. Later, he needed to add more rows
    15·2 answers
  • Why is the answer A?
    6·1 answer
  • In apersuasive message, opposing ideas should be:
    13·1 answer
  • Rule number one for handling an emergency is to _____. A. buy a new vehicle B. call law enforcement C. remain calm D. restart th
    6·2 answers
  • Blood Alcohol Level (BAL) is the ratio between the alcohol consumed and the blood in the body. A. True B. False
    12·2 answers
  • Briefly explain specialisation?​
    11·1 answer
  • What is the Is option that prints the author of a file​
    7·1 answer
  • Using a text editor, create a file that contains a list of at least 15 six-digit account numbers. Read in each account number an
    7·1 answer
  • Guys, please help me asap (Photo Attached) !!!!!!! HELP 25pts!!!!
    14·2 answers
  • Anyone have any website ideas I could use for my computing website project? Thank you.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!