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]
2 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]2 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
What led to fall of axum?
stiks02 [169]
The main factors that led to the fall of the Aksum in the seventh century were climate change and the obstruction of international trade routes around the Red Sea brought on by the growing supremacy of the Muslims in Ethiopia.<span> Other contributing factors included a reduced crop yield due to excess cultivation of land, Persian interference and the rise of Christianity in the region.</span>
3 0
2 years ago
Read 2 more answers
What is included in a linked list node?
Annette [7]

Explanation:

In its most basic form, each node contains:

data, and a reference (in other words, a

link) to the next node in the sequence. A

linked list whose nodes contain two fields:

an integer value and a link to the next node.

The last node is linked to a terminator used

to signify the end of the list.

8 0
3 years ago
Draw directed graphs representing relations of the following types.
mixas84 [53]

Answer:

The first graph in the picture describes a relation that is (a) Reflexive, transitive, and anti-symmetric.

Because a, b, c, d all are related to itself, so reflexive.

where (a, b) and (b, d) are in the relation, (a,d) is in the relation,    

for (c,a) and (a,b) there is (c,b).

so it's transitive.

for all a,b in the relation, (a,b) there is no (b,a) with a ≠b.

The second graph in the picture describes a relation that is (b) Reflexive, transitive, and neither symmetric nor anti-symmetric.

Because a, b, c, d all are related to itself, so reflexive.

where (a, b) and (b, a) are in the relation, (a,a) is in the relation,                                                    

where (c, d) and (d, d) are in the relation, (c,d) is in the relation,                                                    

so it's transitive.

Because, (a,b) and (b.a) are there, but for (c,d) there is no (d,c) in relation.

So, the relation is not symmetric.

(a,b) and (b,a) is in relation but, a≠b, so not anti symmetric.

Explanation:

For all a in a set,  if (a,a) in a relation then the relation is reflexive.

For all (a,b) in relation R, if (b,a) is also in R, then R is symmetric.

For all (a,b), (b,c) in relation R, if (a,c) is also in R, then R is transitive.

For all (a,b), (b,a) in R, a = b,  then R is an anti- symmetric relation.

3 0
2 years ago
Which of the following is a computer procedure that takes raw data and and changes it into information
vesna_86 [32]

Answer

The answer is A

Explanation:

4 0
3 years ago
Read 2 more answers
A financial document that shows a company's income and expenses is a _____. balance sheet personal budget profit-and-loss statem
Maslowich

Answer:

Profit and Loss Statement

7 0
3 years ago
Other questions:
  • Why might location be important when searching for a job?
    10·2 answers
  • In terms of object-oriented programming,after class is defined,________ can be created for that class.
    15·1 answer
  • Match the careers with the education required for each job
    5·1 answer
  • Which of the following works on the pay-per-click (PPC) and cost-per-click (CPC) concept? ~ Plato
    9·1 answer
  • Who can help me on my school we will to google meet and i share my screen
    5·1 answer
  • Please hurry Arrange the steps of the engineering design process in the correct sequence.
    10·1 answer
  • BRAINLIEST You have a small company and want to keep your costs low, but it is important your employees share data. Which networ
    13·2 answers
  • Which programming paradigm does the programming language JavaScript follow?
    14·1 answer
  • What are some innovations that television has undergone since its original invention ?
    11·1 answer
  • Quick I need help ASAP
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!