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
About.com is considered a (an):
Andrei [34K]
About. com that changed its name recently to dotdash is basically a subject directory. It is a colection of blogs articles about various general intrests of writers. Most of the information it contains is not vetted and thus does not qualify as reference point.
7 0
2 years ago
You need to design a backup strategy. You need to ensure that all servers are backed up every Friday night and a complete copy o
cestrela7 [59]

Answer: (A) full backup

Explanation: A backup strategy is a term used to describe the various effective approach engaged in creating a backup for data or information.

A FULL BACK UP IS THE VARIOUS APPROACH AND SYSTEMS PUT IN PLACE BY A COMPUTER USER OR AN INFORMATION TECHNOLOGY EXPERT IN ORDER TO CREATE AN ADDITIONAL SAMPLE OR COPY OF AN INFORMATION OR A DATA IN S SINGLE BACKUP.

8 0
3 years ago
What are some tasks for which you can use the VBA Editor? i need help for my computer class.
Murljashka [212]

Answer:

Visual Basic for Applications runs as an internal programming language in Microsoft Office applications such as Access, Excel, PowerPoint, Publisher, Word, and Visio. VBA allows users to customize beyond what is normally available with MS Office host applications by manipulating graphical-user-interface (GUI) features such as toolbars and menus, dialogue boxes, and forms. You may use VBA to create user-defined functions (UDFs), access Windows application programming interfaces (APIs), and automate specific computer processes and calculations. Macros can automate just about any task—like generating customized charts and reports, and performing word- and data-processing functions. Programmers,like replicating large pieces of code, merging existing program functions, and designing specific languages. VBA can also work in non-Microsoft settings by using a technology called "COM interface," which allows commands to interact across computer boundaries. Many firms have implemented VBA within their own applications, both proprietary and commercial, including AutoCAD, ArcGIS, CATIA, Corel, raw, and SolidWorks.

<em>(Hope this helps/makes sense!)</em>

6 0
3 years ago
I need help with this plz! It’s for a test and I really need help
Bas_tet [7]

Answer:

c

Explanation:

assuming you are coding in python and have not install any calculation codes, the answer is most likely c

4 0
3 years ago
Which of the following statements is true about scalability? Choose 3 options.
Simora [160]

Answer:

4, 5, 2

Explanation:

just did it on edge :)

3 0
2 years ago
Read 2 more answers
Other questions:
  • When seeking information on the Internet about a variety of subjects, the most
    7·2 answers
  • In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
    10·1 answer
  • Ok.,so i have a sopitify account and by accident i pressed the downlaod on button and it says start you free trial i pressed tha
    11·2 answers
  • Develop a program that will maintain an ordered linked list of positive whole numbers. Your program will provide for the followi
    13·1 answer
  • What actions can you take to ensure the physical security of network devices?
    14·2 answers
  • Select the correct answer. Which sign or symbol will you use to lock cells for absolute cell reference?
    9·2 answers
  • Which of the following lines of code correctly defines a function called combine? OA define "combine(a, b, c)" as: B. define(com
    9·1 answer
  • Zara wants to create some lines of code that are ignored by the computer. What should these lines begin with?
    5·1 answer
  • the ghost adventures team uses a variety of tools and technology in investigations. which one is described as an adjustable freq
    9·1 answer
  • What can be used to help diagnose and fix computer hardware problems?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!