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
What field in an IPv4 packet is altered to prioritize video streaming traffic over web surfing traffic?
Serhud [2]

Answer:

DiffServ (Differentiated Service)

Explanation:

DiffServ (Differentiated Service) field is used to prioritize traffic in IPv4 packet.

DiffServ is used as QoS (quality of service) on networks at Layer 3, replacing former IPv4 TOS field to effectively deal with the web traffic and prioritization issues starting from 1998.

3 0
3 years ago
Write statementsto show how finding the length of a character array char [ ] differs from finding the length of a String object
NARA [144]

Answer:

Length of char array: sizeof(arr)

Length of a string object: myString.length()

Explanation:

The sizeof approach is generally not recommended, since this information is lost as soon as you pass the array to a function, because then it becomes a pointer to the first element.

4 0
3 years ago
Which of the following are correct? I. Hold the middle mouse button to rotate the model on the screen. II. To pan the model, hol
evablogger [386]

Answer:

II and III are correct

Explanation:

The software that the question is referring to here is the computer-aided design (CAD) software called Inventor by Autodesk.

I. Hold the middle mouse button to rotate the model on the screen. False

This will pan the model instead of rotating.

II. To pan the model, hold down the Ctrl key and the middle mouse button. True

Some versions need you to hold down the ctrl key and the middle mouse button to pan, while others is just the middle mouse button then you drag the mouse around. The middle mouse is the scroll wheel on most mice today. You basically, just hold down the scroll wheel as you move the mouse to pan the model.

III. Use the mouse scroll wheel to zoom in and out of the model. True

To zoom in or out, one will need to rotate the mouse scroll wheel forward to zoom in and backward to zoom out.

 

8 0
3 years ago
A written guarantee to fix or replace an item is called a _____.
VladimirAG [237]
A warranty is a statement given by the manufacturer or other company
3 0
3 years ago
Read 2 more answers
4.9 Code Practice: Question 4
hichkok12 [17]

total = 0

i = 0

while i < 10:

   temp = float(input("Enter Temperature: "))

   total += temp

   i += 1

print("Sum =", str(total))

I hope this helps!

7 0
3 years ago
Other questions:
  • What is the primary criticism against a national identification system based on biometric data?
    13·1 answer
  • HELPPP ASAPP
    8·2 answers
  • Which best describes a hybrid drive?
    11·1 answer
  • List three different sets of keywords that could be used to search for information on how to
    15·1 answer
  • Customizable diagrams, including List, Process, and Cycle diagrams, are built into Word and can be found in
    7·1 answer
  • You want to calculate a bonus if the sold price was at least equal to the listing price, and if the house sold within 30 days af
    6·1 answer
  • You attempt to telnet to system 192.168.1.240. You receive the following message: "Connecting To 192.168.1.240...Could not open
    5·1 answer
  • ¡Hola! He visto en muchos comentarios de Twitter "svd" cuando alguien dice "dale fav a este Tweet y siganse entre ustedes" y en
    8·1 answer
  • Which is NOT one of the basic characteristics of life? What feature of Microsoft
    5·1 answer
  • Why can't this app have people ask riddles.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!