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
A 9-year old male castrated Westie presents on emergency after being rescued from a house fire. On presentation, the dog has a r
SVEN [57.7K]

Answer:

The correct option to the following question is Carbon monoxide

Explanation:

Most common symptom of Carbon Monoxide poisoning are dizziness, headache, weakness, vomiting, upset stomach, confusion, and chest pain. The Carbon monoxide or CO symptom is often that described as “flu-like.” If the breaths in a lot of the Carbon monoxide or CO then it can make pass out any person or it kills you.

5 0
3 years ago
Every time you are asked to work with others, you are being asked to:
soldier1979 [14.2K]
D. Be part of a team
3 0
4 years ago
Read 2 more answers
A great way to avoid tech distraction is to __
Ksivusya [100]

Answer:

B

Explanation:

This is because you are only restraining yourself from using your phone when you are NOT at the stop lights (or you could perhaps say Red Lights). I hope this was helpful! :)

4 0
3 years ago
Read 2 more answers
I will give brainiest to the person that is right. What is change management?
Serggg [28]

Answer:

Umm I think it's A I am not sure tho

3 0
3 years ago
One of the advantages of simulation is​ that: A. it is a repetitive approach that may produce different solutions in repeated ru
Dafna1 [17]

Answer:

A. it is a repetitive approach that may produce different solutions in repeated runs.

5 0
4 years ago
Read 2 more answers
Other questions:
  • Define reverse engineering in hacker context
    15·1 answer
  • What is created for each user the first time the user logs onto windows?
    7·1 answer
  • A number used to encrypt data is called a(n ________. signature key cookie escrow
    10·1 answer
  • In terms of online safety, what is the grooming process, (predators).
    5·2 answers
  • Diane is receiving a lot of unwanted e-mail. What steps can she take to reduce the amount of e-mail she receives?
    12·1 answer
  • Question 19 :Rachel, a database administrator, has created a database for her website. It contains pictures of vacations that pe
    13·1 answer
  • Can someone please help me on these short short questions marking Brainly computer modeling people please help
    14·1 answer
  • You receive an email from a woman claiming her father was poisoned by business associates, but before his passing placed 12 mill
    12·2 answers
  • There are three groups of people, people who like Apples, Bananas, and Cherries. 19 people like Apples. 23 people like Bananas.
    15·1 answer
  • Write a function named swapFrontBack that takes as input a vector of integers. The function should swap the first element in the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!