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 Chief Information Security Officer (CISO) needs to establish a KRI for a particular system. The system holds archives of contr
OLga [1]
B. Percent of patches applied in the past 30 days
6 0
3 years ago
Sam has sent Sally an email. Sally wants to answer him without manually typing in his email address. Which email option should s
tiny-mole [99]

Answer:

reply

Explanation:

hit the reply button to do that

3 0
3 years ago
Read 2 more answers
In cell F15, insert a function that will automatically display the word Discontinue if the value in cell D15 is less than 1500,
777dan777 [17]

Answer:

=IF(D15<1500, "Discontinue", "No Change")

Explanation:

Assuming that this is excel, you can locate the cell F15 and input the IF function. The formula for IF function is

IF(<condition>, <action if true>, <action if false>)

So before the 1st comma, we place the condition which is D15 < 1500

In the middle, before the 2nd comma, we place the text to display if D15 is less than 1500, which is "Discontinue".

In the last place, we place the text to display if D15 is greater than or equals to 1500, which is "No Change"

So the overall formula is =IF(D15<1500, "Discontinue", "No Change")

3 0
3 years ago
GIVING BRAINLIEST Jenna creates advertisements for companies to air on television. Which file format will best preserve the grap
77julia77 [94]

Answer:

MpEg

Explanation:

7 0
3 years ago
Read 2 more answers
Which of the following sets of acronyms is concerned with encoding data for secure transmission?
guapka [62]

I'm pretty sure your answer is VPN. Hope this helps!

7 0
3 years ago
Other questions:
  • Monica needs a printer to use at home. She wants fine-quality prints at an affordable cost. Which printer will help her achieve
    9·1 answer
  • Which social media marketing concept engages visitors, getting them to revisit your website and tying them to offline events for
    7·2 answers
  • In the Word 2016 window, where is the Status bar located?
    11·2 answers
  • A key field is used to _____. enter a password uniquely identify records merge data list the most important information
    12·2 answers
  • Write a program that reads from the user any three points in two dimensional space: x1, y1, x2, y2, x3, y3. Assume these points
    13·1 answer
  • What does it mean for a heap to be complete?
    7·1 answer
  • several ways that we commonly use technology today that people couldn't 10 years ago. Are these uses helpful or harmful to socie
    9·1 answer
  • Place the steps in order for creating a Custom Search Folder in Outlook 2016.
    9·2 answers
  • HELP ASAP Encoding a video format and then decoding it during playback is one of the functions of MPEG-4 and H.264 file players.
    10·2 answers
  • Someone put malware on your computer that records all of your keystrokes. what aspect of security was primarily attacked? choose
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!