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
Tatiana [17]
3 years ago
11

i need to also do a algorithm where if the total is a even number 10 points are added to the score and if the total is odd then

5 points are subtracted. i have the part about the 10+ or 5- but im not sure how to do the even or odd number variable. help would be appreciated :) (im using python)
Computers and Technology
1 answer:
algol [13]3 years ago
5 0

Answer:

def UpdateScore(score, total):

   if total % 2:

       print total, "is odd, so adding 10"

       score += 10

   else:

       print total, "is even, so subtracting 5"

       score -= 5

   print "The score is now",score

   return score

score = 0

score = UpdateScore(score, 3)

score = UpdateScore(score, 6)

Explanation:

The % operator returns the remainder after division. So if you divide by 2, the remainder is either 0 or 1, where 0 indicates an even number, and 1 indicates an odd number. The above program shows that.

You might be interested in
Let X and Y be two decision problems. Suppose we know that X reduces to Yin polynomial time. Which of the following statements a
DerKrebs [107]

Answer:

d. If X is NP - complete and Y is in NP then Y is NP - complete.

This can be inferred

Explanation:

The statement d can be inferred, rest of the statements cannot be inferred. The X is in NP complete and it reduces to Y. Y is in NP and then it is NP complete. The Y is not in NP complete as it cannot reduce to X. The statement d is inferred.

4 0
3 years ago
In which type of attack do you get malicious code in links from seemingly reliable websites?
natali 33 [55]

I think it is C. cross-site scripting

6 0
3 years ago
Which peripheral device is used to record sound?
faust18 [17]

he will need a microphone, it is a recording device.

8 0
2 years ago
Read 2 more answers
Imagine that one of your clients has complained to your manager that you have not responded quickly to his e-mails. Compose an e
Galina-37 [17]
Dear Mr. _____,
I am truly sorry for the inconvenience and I promise to work faster to more quickly solve your problem so that you can continue to enjoy your day without worrying about the situation. Next time I will respond back faster to ensure that your problem is fixed as quickly as possible.

Sincerely,
_____________

6 0
3 years ago
OSHA requires training for employees on the hazards to which they will be exposed.
Sedaia [141]

A, OSHA does require training for employees on the hazards to which they will be exposed.


3 0
3 years ago
Read 2 more answers
Other questions:
  • Read three integers from user input. Then, print the product of those integers. Ex: If input is 2 3 5, output is 30. Note: Our s
    6·1 answer
  • This information is generally included on a fax cover sheet.
    15·1 answer
  • Create an instance of your queue that accepts java.lang.String Objects. Starting with an empty queue, use the enqueue(E e) metho
    15·1 answer
  • What is the first step that you have to perform before you can add a windows package to a wim file?
    9·1 answer
  • PAGE<br>DATE<br>0 What types of information should be there internet?​
    5·1 answer
  • Please help! I tried this by myself. But I am not sure if this is right.
    8·2 answers
  • The graphic shows a cause and effect organizational aid.
    6·1 answer
  • Which lighting technique can often heighten a dramatic story?
    14·1 answer
  • Derek has to create a technical design of a complex floor plan using CAD. What will be most helpful for Derek to use to create t
    8·1 answer
  • A program that converts a program to binary all at once and runs the entire program when finished with the conversion.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!