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
Digital security measures include _____. Select 2 options.
elixir [45]

Answer:

firewalls

passwords

8 0
3 years ago
Read 2 more answers
Splunk knows where to break the event, where the time stamp is located and how to automatically create field value pairs using t
schepotkina [342]

Answer:

The answer is "Option a".

Explanation:

Splunk is a software that is used for captures, indexes, and it provides a collection of real-time data. It is also known as a searchable archive that can be used to produce maps, charts, warnings, dashboards, and visualizations. It is a hierarchical system used to handle software, protection, and security, and to analyze enterprise and network. and other options are incorrect that can be described as follows:

  • In option b, It tells the name of the file and it also described the type of file like text file, image file, etc. That's why it is not correct.
  • In option c, This option is used to add data into the new line, that's why it is not correct.

7 0
4 years ago
Send me friend rq ;)
kondaur [170]

Answer:

shore

Explanation:

4 0
3 years ago
Read 2 more answers
A solid weighs 20gf in air and 18gf in water .find the specific gravity of the solid​
swat32
<h2>Answer:</h2>

10

<h2>Explanation:</h2>

Specific gravity (also called relative density) is the ratio of the density of an object (or substance) to the density of a reference substance (mostly water). It has no unit and is given by the following;

Specific gravity = \frac{density-of-object}{density-of-water}

Specific gravity is also given by the ratio of the weight of the object in air to the loss of weight of the object in water. i.e

Specific gravity = \frac{weight-of-object-in-air}{loss-of-weight-in-water}            --------------(* * *)

In this case;

i. The object is the solid which has a weight of 20gf in air.

ii. The loss of weight of the solid in water is the difference between the weight in air (20gf) and the weight in water (18gf).

Therefore the loss of weight is

20gf - 18gf = 2gf

Now substitute these values from (i) and (ii) into equation (* * *) as follows;

Specific gravity = \frac{20gf}{2gf}

Specific gravity = 10

Therefore the specific gravity of the solid is 10

7 0
3 years ago
Which of the following options correctly represent a formula with Absolute References?
lakkis [162]
The answer is D =(<span>$A$1-$B$1) 

sources:just took the test</span>
3 0
3 years ago
Read 2 more answers
Other questions:
  • Your client expresses that they want their new website to have a responsivedesign with consistent coding. They are concerned wit
    5·1 answer
  • The formatting option functions like space bar. However instead of moving one space at a time, it allows you to move your text i
    7·1 answer
  • Attempting to determine a password that is not known to the attacker is often called ____.
    13·1 answer
  • These steps describe saving a newly created file.
    14·2 answers
  • Google's Chrome OS integrates with web servers using cloud computing and storage to run applications and to perform other functi
    10·1 answer
  • Ifdjgidfpojcjdizchnllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllsssssssssssssssssssssssssss
    13·2 answers
  • Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a n
    7·2 answers
  • How do news organizations primarily create revenue?
    12·2 answers
  • Mike gets along with his co-workers and is always helpful to the clients. He demonstrates good _____.
    7·2 answers
  • What will the following program display in the console?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!