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
The trim video feature allows you to trim your clip by time measurements that are accurate to ____ of a second.
grigory [225]
The trim video feature allows you to trim your clip by time measurements that are accurate to one-thousandth of a second.  An example would be the P<span>owerPoint's </span>Trim Video feature which allows you<span> to </span>trim<span> the beginning and end of </span>your clip<span> by designating </span>your<span> desired Start </span>Time<span> and End </span>Time. These precise time measurements<span> are </span>accurate<span> to </span>one-thousandth<span> of a </span>second<span>.</span>
3 0
3 years ago
Each device attached to your computer comes with a special program called a(n ________ that enables the device and operating sys
Serhud [2]
Driver- comes with a driver installed.
7 0
4 years ago
Write a statement that adds 1 to the variable reverseDrivers if the variable speed is less than 0,adds 1 to the variable parkedD
Elina [12.6K]

Answer:

if speed < 0:

 reverseDrivers +=1

elif speed < 1:

 parkedDrivers +=1

elif speed < 40:

 slowDrivers +=1

elif speed<=65:

 safeDrivers +=1

else:

 speeder +=1

Explanation:

The statements are written in python programming language

See a complete code screenshot attached, where all the variables are defined

8 0
3 years ago
Show the subnet address, subnet mask in slash notation, broadcast address, number of addresses, first valid host address, and th
sineoko [7]
Subnet 102.176.0.0/12
broadcast 102.191.255.255
lowest 102.176.0.1
highest 102.191.255.254
7 0
4 years ago
1. As part of your community, your school, and your neighbourhood, how else does ICT have an impact on social
NeX [460]

Answer:

helthcare systems, aviation, entertainment, retail, etc

Explanation:

ICT has made life easy, it has made an interconection accross the world. in the helthcare system, ICT has created a positive impact because now a days body check up is been made through computers.

in the aviation, we use computers to control the the traffic of airplanes.

5 0
3 years ago
Other questions:
  • what evidence supports the claims that the Taj Mahal is a symbol of historical and cultural glory as well as an architectural ma
    8·1 answer
  • What are personal skills? A manner of individual style How a person manages and expresses oneself One's ability to excel at spor
    13·2 answers
  • Enter the answer.
    11·2 answers
  • Consider a Games Expo for Children. Six competitions are laid out for the expo. Tickets are sold according to the age and gender
    11·1 answer
  • Jin needs to add a row into his spreadsheet, but he does not want to remove any existing data. Which combination of options shou
    6·2 answers
  • Cryptcat is a Linux distribution that includes hundreds of security and hacking tools, including Nessus and Metasploit. It can p
    11·1 answer
  • Learning how to use software takes time. So, after customers have learned to use a particular software package, it is easier to
    11·1 answer
  • Which tool can effectively increase the curl of the subject’s lips?
    10·2 answers
  • Write a boolean expression that is true if s references the string end.
    8·1 answer
  • Where would you click to see the list of microsoft word styles?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!