Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+5 votes
asked in CSC201 Spring 2021 by (1 point)

3 Answers

+2 votes
Best answer

each race, you can use an if/elif statement to check which owl has the most points, and add 1 to a point counter accumulator variable. something like

if owl1Points>owl2Points:
    owl1Wins = owl1Wins + 1 
answered by (1 point)
selected by
+1 vote

You have to create another variable to accumulate the score each owl getting after each race.
Also, you will you if/elif/else to filter the result.
For example,

score1 = 0
score2 = 0

If the first owl won the race, then adding 1 score in score1, it would be:

score1 = score1 +1

If the second owl won the race, then adding 1 score in score2, it would be:

score2 = score2 +1

If both owls get a tie, then each owl gets half of the score, it would be:

score1 = score1 +0.5
score2 = score2 +0.5

Or if they get a tie, both owls won't get any score (It's up to you if you wanna add a score or not for a tie)

After all, you will compare the score between score1 and score2 to see which one is greater and become a winner. If there is a tie again, there is no champion.

Hope this helps!

answered by (1 point)
+1 vote

After each race, in the same loop, use an 'if' statement to add a point to the winner base on the distance they flew
After that adds up in the outside loop the score, then you can use an if statement to compare the score and have the winner

answered by (1 point)