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
(true/false) In a layered operating system design, requests (such user processes may need to interact with multiple layers, resu
Julli [10]

Answer:

The correct answer to this question is "true".

Explanation:

In a layered operating system, all the layers defined individually and communicate with each other when required. It is also easier to create, manage and update the system. If we change in one layer. The Changement has done in only a specific layer it does not affect any other layers. In this operating system, there are 6 layers.

In the monolithic system. It works on the kernel space. That increases the size of the operating system and kernel. It is different than the microkernel system. In the monolithic system, there are 3 layers.

If we assign any work to both, So the 6 layers will take more time to do that work. when that 3 layers take less time to do that work.

that's way layered operating performance is slower than the monolithic system.

6 0
4 years ago
I want to make a if else statement where I want to make a message. If the input are letters (which it’s not supposed to) then I
MrRa [10]

Answer:scratch, im in it (22550077) AND ALSO IF MEANS LIKE IF YOU SAY HI THEN IT SAYS HI OR IF YOU SAY START GAME THE GAME STARTS

Explanation:

4 0
3 years ago
We all interact with various information systems every day: at the grocery store, at work, at school, even in our cars (at least
Serhud [2]

Explanation:

An information system can be defined as an automated system or not, which is used for the purpose of collecting data and transforming it into relevant information for a given purpose.

Currently, information systems are increasingly used in the organizational environment, for example, as management information systems and decision support systems, which are automated computer systems that provide greater support to a manager's work, due to the amount of data that store and process relevant information to assist in the speed of the decision-making process, since information systems are able to capture a volume of data and analyze it, create standards, find flaws and transmit essential information that makes the manager's work more facilitated and improved.

8 0
3 years ago
Programmers refer to a sequence of characters as a ____.
jekas [21]
In programming they know it as a String which is  a sequence of characters that are composed of literal constants or some kind of variables. A sting is any finite sequence of characters. every single string has its own lenght and this is one of the most important characteristics of them. Strings are essential to communicate information from the program to the user. 
5 0
3 years ago
Seth is considering advertising his business using paid search results.What do you think makes paid search advertising so effect
pychu [463]

You haven't given any statements to choose from, but I can explain why paid search results are effective.

Paid seach results market to consumers that are interested in the product or similar products. These consumers are more likely to buy the product, since they are searching for a similar term. Paid search results can reach many people in very little time, and their resulting marketing benefits are almost instantaneous.

5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the process of getting as many people as possible to visit your website called? A. Maximizing keyword potential B. Direc
    9·2 answers
  • A security analyst is investigating a call from a user regarding one of the websites receiving a 503: Service unavailable error.
    10·1 answer
  • Assume that the myname.txt file is currently closed. write the code segment that opens the file without erasing it, write anothe
    13·1 answer
  • Huffman trees use the _________ of each character to work out their encoding. A) Frequency B) Order in ASCll
    12·1 answer
  • Rita wants to know the size of each image in a folder. Which view will help her find this information quickly?
    13·1 answer
  • Someone wanna be in a meeting with me <br><br><br> Code: rrx-ofrw-ocj
    5·2 answers
  • What does GUI stands for and what is it function?​
    5·2 answers
  • Ten output devices you know
    10·1 answer
  • PLEASE HELP THIS IS CONFUSING ME
    8·2 answers
  • When developing an output control system, it is important to implement output standards that: (Choose all that apply.)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!