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
antoniya [11.8K]
3 years ago
15

Define a function calculate_range that consumes a temperature and returns a tuple of two numbers, the high and the low. These nu

mbers are calculated as follows:
high = temperature + 20
low = temperature - 30
Then, you will need to call your function once to create two variables today_low and today_high for today's temperature of 70.
Note: Your function will be unit tested against multiple arguments. It is not enough to get the right output for your own test cases, you will need to be able to handle any kind of number.
Note: You are not allowed to use list or tuple indexing.
Note: You may only call your function once.

Computers and Technology
1 answer:
Setler [38]3 years ago
7 0

Answer:

def calculate_range(temperature):

   high = temperature + 20

   low = temperature - 30

   return low, high

today_temp = 70

today_low , today_high = calculate_range(today_temp)

print('Today\'s low = {}\nToday\'s high = {}'.format(today_low, today_high))

Explanation:

The programming language used is python.

The code define the calculate_range function that takes only one parameter temperature.

The function evaluates both high and low temperature and returns a tuple containing both values.

we test the function by creating a temperature variable for today and passing it to the function and this in turn returns two values today_low and today_high.

Your question specifies no need for indexing.

There is a really simple way of unpacking tuple objects, which is used to assign the values returned by the function to separate variables.

<em>today_low , today_high = calculate_range(today_temp)  </em>

Finally, today_low and today_high is printed to the screen.

check the picture to see results of running the code.

You might be interested in
Describe the features of agile modeling​
Allushta [10]

Answer:

si gigi hadid tapos si bella poarch

Explanation:

7 0
3 years ago
Write a function using statements called Print Reportl) which will take no float
Sedbober [7]

Answer:

the answer is going to be district b

5 0
3 years ago
Universal Containers offers a variety of products that are comparable to products from other companies. Sales representatives re
-Dominant- [34]

Answer:

The System Administrator should implement a Competitors  on the opportunity Page Layout

Explanation:

<em>Because, it allows basic information to be captured about the competitors on each opportunity. Besides it qualifies opportunities based on historic success against competitors, tailors the sales approach based on the competitors each deal and consistently increases win rates by learning what worked and what did not.</em>

5 0
3 years ago
"A Windows laptop is being used by a teacher in an outdoor (but protected by an overhang) setting. What setting would ensure tha
iragen [17]

1.Click the battery btn and go into power option.

2.Go into "When to turn off display" from left side bar menu.

3.And select for brightness drop down as never dims the display.

This will make the display turn on, no matter if the PC keyboard btn or mouse hower is clicked or not.

4 0
3 years ago
A(n) _____ is a flexible tool used to analyze data using reports that do not have a predetermined format.
Mandarinka [93]

Answer:

decision support system

Explanation:

4 0
3 years ago
Other questions:
  • A cashier distributes change using the maximum number of five-dollar bills, followed by one-dollar bills. Write a single stateme
    13·1 answer
  • Why do computers need to periodically check the dns for websites you have already visited? enter your answer here?
    15·1 answer
  • Which is the largest unit of measurement for computer data?
    14·1 answer
  • Which of the following is considered part of the process in the systems thinking example of a TPS?
    6·1 answer
  • Write a Java program that will 1. Ask the user to type in a sentence, using a JOptionPane.showInputDialog(). 2. The program will
    10·1 answer
  • When someone makes a bad or immoral decision because a group of their friends is also doing it, it is called:
    10·1 answer
  • 6. When working with a file,
    9·1 answer
  • Determine what is printed by the following code.
    8·1 answer
  • I NEED INFORMATION ON THE WALT DISNEY VS. FADEN CASE ASAP<br> WILL GIVE BRAINLIEST
    8·2 answers
  • You are building a game that needs to do the following:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!