answer.
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
MariettaO
2 months 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:
zubka84 [1K]2 months ago
4 0

Response:

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")

Clarification:

This line initiates the function

def calculate_score(theTuple):

This line extracts the values used in the function

    first, second, third = theTuple

The subsequent if statement verifies whether the values fall within the 0 to 10 range

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

This computes the total score

         print(first + second + third)

else:

Should the scores be outside the 0 to 10 limits, this line will be executed

         print("Range must be 0 to 10")

You might be interested in
Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
ivann1987 [1066]

Answer:

129 \frac{2}{?} 23.4. \div 164 \times 5y1 +. \\.00487ggh

6 0
2 months ago
Identify the four basic categories of hardware in a personal computer system
Harlamova29_29 [1022]
The four primary categories include the motherboard, CPU, graphics card, and RAM.
Please choose Brainliest! Thanks!:)
5 0
1 month ago
OCR Land is a theme park aimed at children and adults. Entrance tickets are sold online. An adult ticket to OCR Land costs £19.9
Rzqust [1037]

Answer:

count = 0

while count!= 8:

height = float(input("Enter the height of the rider: "))

if height >= 140:

print("You may ride")

count += 1

else:

if height >= 120:

answer = input("Is the rider accompanied by an adult (yes/no): ")

if answer == "yes":

print("You may ride")

count += 1

else:

print("You are not permitted to ride")

else:

print("You are not permitted to ride")

Explanation:

Begin with a count of zero, which will track the number of riders allowed. Use a while loop that continues until the count reaches 8. During each iteration, request the user's height. If the height is 140 cm or taller, display "You may ride" and increment the count. If the height is 120 cm or more, check if the rider is with an adult. If not, show the message "You are not permitted to ride"; otherwise, allow the ride and increase the count. If the height is below 120 cm, deny the ride.

5 0
2 months ago
A four-year-old laptop will not boot and presents error messages on screen. You have verified with the laptop technical support
8_murik_8 [964]
Consider whether the laptop is worth fixing. If it is, proceed with the repair, and if it isn’t, you know the next steps.
7 0
2 months ago
Other questions:
  • U.S. industries like steel, computers, and energy need to be protected from foreign competition to ensure which of the following
    6·2 answers
  • In 2007, this wireless security algorithm was rendered useless by capturing packets and discovering the passkey in a matter of s
    6·2 answers
  • The position of a runner in a race is a type of analog data. The runner’s position is tracked using sensors. Which of the follow
    8·1 answer
  • What advantage do ExpressCard modules and USB adapters offer over expansion cards?
    5·1 answer
  • The ______ is the information center that drivers need to refer to when they're NOT scanning the road.
    7·1 answer
  • #Write a function called "angry_file_finder" that accepts a #filename as a parameter. The function should open the file, #read i
    13·1 answer
  • Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els
    15·2 answers
  • CHALLENGE ACTIVITY 2.9.1: Coordinate geometry. Determine the distance between points (x1, y1) and point (x2, y2), and assign the
    6·1 answer
  • In today’s fast-paced, often "agile" software development, how can the secure design be implemented?
    11·1 answer
  • The matrix theory is used in the ___ technique
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!