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
77julia77 [94]
3 years ago
7

Exercise 8.1.9: Diving Contest Your school is hosting a diving contest, and they need a programmer to work on the scoreboard! Yo

ur job is to calculate each diver's total after the three judges hold up their individual scores. Write the function calculate_score which takes a tuple of three numbers from 0 to 10 and calculates the sum. A perfect dive is worth 30 points, a belly flop is worth 0. For example: calculate_score((10, 10, 10)) # => 30 calculate_score((9, 9, 6)) # => 24 can someone help?
Computers and Technology
1 answer:
vampirchik [111]3 years ago
4 0

Answer:

def calculate_score(theTuple):

    first, second, third = theTuple

    if first >= 0 and first <=10 and second >= 0 and second <=10 and third >= 0 and third <=10:

         print(first + second+third)

    else:

         print("Range must be 0 to 10")

Explanation:

This line defines the function

def calculate_score(theTuple):

This line gets the content of the function

    first, second, third = theTuple

The following if condition checks if the digits are in the range 0 to 10

    if first >= 0 and first <=10 and second >= 0 and second <=10 and third >= 0 and third <=10:

This calculates the sum

         print(first + second+third)

else:

If number is outside range 0 and 10, this line is executed

         print("Range must be 0 to 10")

You might be interested in
What is the portrait mode ?
Effectus [21]
On a camera portrait mode is when the camera is vertical.
7 0
2 years ago
Who Plays Rainbow six siege
vekshin1
What’s that? I never heard of it.
4 0
2 years ago
Read 2 more answers
What does RoHS stand for and why is RoHS compliance important?
gladu [14]

Answer:

It stands for Restriction of Certain Hazardous Substances.

Web search says it is important because,

RoHS compliance dovetails into WEEE by reducing the amount of hazardous chemicals used in electronic manufacture. Put another way, RoHS regulates the hazardous substances used in electrical and electronic equipment, while WEEE regulates the disposal of this same equipment.

Explanation:

8 0
3 years ago
building a robot that could perform surgery on its own. Would you rather have it rely on a basic algorithm with a human supervis
PolarNik [594]
Program that uses machine learning.
8 0
2 years ago
Read 2 more answers
In Florida, No-Fault insurance is optional for owners of a vehicle.<br> A. True<br> B. False
scoray [572]
The correct answer is B. false
3 0
3 years ago
Read 2 more answers
Other questions:
  • Students can use eNotes to type notes directly on screen and
    11·2 answers
  • Marcus just created a new folder specifically for his buisness records so he would like to move last months business transaction
    13·2 answers
  • What difference between plagiarism and fair use?
    14·1 answer
  • If you are working on a document and want to have Word automatically save the document every minute, what steps should you use t
    13·1 answer
  • Which recorder is least recommended in automation anywhere?
    11·2 answers
  • Which administrative tool can you use to check your computer's health or troubleshoot problems with the operating system or soft
    11·2 answers
  • The I/O modules take care of data movement between main memory and a particular device interface.A. TrueB. False
    9·1 answer
  • WHO WANTS TO PLAY AMONG US
    15·2 answers
  • Key Categories: more libraries and thousands of functions
    5·1 answer
  • Edhesive 2.3 code practice question 1​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!