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
How many total bits are required for a direct-mapped cache with 128 blocks and a block size of 8 bytes, assuming a 4GB main memo
Marysya12 [62]

Answer:

32

Explanation:

Total bits will be 32 only as address is of 32 bits

(meaning to ask the size of the cache)

7 0
2 years ago
To give your app users the ability to open your app directly from other apps by clicking a link, you should use:.
pickupchik [31]
<span>To give your app users the ability to open your app directly from other apps by clicking a link, you should use:  deep link. With the deep link and its URL functionality, existing app users are driven directly inside the mobile app itself. 
</span>Deep links are usually made up of two parts: a scheme (part of the link that identifies which app to open).<span>and a </span>host and path (<span>the unique location in the app where your content exists).</span>

7 0
2 years ago
Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600 MHz. Computer B has a CPI of 2.5 and can be run at a
kirill115 [55]

Answer:

Check the explanation

Explanation:

CPI means Clock cycle per Instruction

given Clock rate 600 MHz then clock time is Cー 1.67nSec clockrate 600M

Execution time is given by following Formula.

Execution Time(CPU time) = CPI*Instruction Count * clock time = \frac{CPI*Instruction Count}{ClockRate}

a)

for system A CPU time is 1.3 * 100, 000 600 106

= 216.67 micro sec.

b)

for system B CPU time is =\frac{2.5*100,000}{750*10^6}

= 333.33 micro sec

c) Since the system B is slower than system A, So the system A executes the given program in less time

Hence take CPU execution time of system B as CPU time of System A.

therefore

216.67 micro = =\frac{2.5*Instruction}{750*10^6}

Instructions = 216.67*750/2.5

= 65001

hence 65001 instruction are needed for executing program By system B. to complete the program as fast as system A

3 0
3 years ago
Create a simple JavaScript calculator.
Gre4nikov [31]

Answer: edit out anything you dont need

<!DOCTYPE html>  

<html lang = "en">  

<head>  

<title> JavaScript Calculator </title>  

 

<style>  

h1 {  

   text-align: center;  

   padding: 23px;  

   background-color: skyblue;  

   color: white;  

   }  

 

#clear{  

width: 270px;  

border: 3px solid gray;  

   border-radius: 3px;  

   padding: 20px;  

   background-color: red;  

}  

 

.formstyle  

{  

width: 300px;  

height: 530px;  

margin: auto;  

border: 3px solid skyblue;  

border-radius: 5px;  

padding: 20px;  

}  

 

 

 

input  

{  

width: 20px;  

background-color: green;  

color: white;  

border: 3px solid gray;  

   border-radius: 5px;  

   padding: 26px;  

   margin: 5px;  

   font-size: 15px;  

}  

 

 

#calc{  

width: 250px;  

border: 5px solid black;  

   border-radius: 3px;  

   padding: 20px;  

   margin: auto;  

}  

 

</style>  

 

</head>  

<body>  

<h1> Calculator Program in JavaScript </h1>  

<div class= "formstyle">  

<form name = "form1">  

     

   <!-- This input box shows the button pressed by the user in calculator. -->  

 <input id = "calc" type ="text" name = "answer"> <br> <br>  

 <!-- Display the calculator button on the screen. -->  

 <!-- onclick() function display the number prsses by the user. -->  

 <input type = "button" value = "1" onclick = "form1.answer.value += '1' ">  

 <input type = "button" value = "2" onclick = "form1.answer.value += '2' ">  

 <input type = "button" value = "3" onclick = "form1.answer.value += '3' ">  

  <input type = "button" value = "+" onclick = "form1.answer.value += '+' ">  

 <br> <br>  

   

 <input type = "button" value = "4" onclick = "form1.answer.value += '4' ">  

 <input type = "button" value = "5" onclick = "form1.answer.value += '5' ">  

 <input type = "button" value = "6" onclick = "form1.answer.value += '6' ">  

 <input type = "button" value = "-" onclick = "form1.answer.value += '-' ">  

 <br> <br>  

   

 <input type = "button" value = "7" onclick = "form1.answer.value += '7' ">  

 <input type = "button" value = "8" onclick = "form1.answer.value += '8' ">  

 <input type = "button" value = "9" onclick = "form1.answer.value += '9' ">  

 <input type = "button" value = "*" onclick = "form1.answer.value += '*' ">  

 <br> <br>  

   

   

 <input type = "button" value = "/" onclick = "form1.answer.value += '/' ">  

 <input type = "button" value = "0" onclick = "form1.answer.value += '0' ">  

   <input type = "button" value = "." onclick = "form1.answer.value += '.' ">  

   <!-- When we click on the '=' button, the onclick() shows the sum results on the calculator screen. -->  

 <input type = "button" value = "=" onclick = "form1.answer.value = eval(form1.answer.value) ">  

 <br>  

 <!-- Display the Cancel button and erase all data entered by the user. -->  

 <input type = "button" value = "Clear All" onclick = "form1.answer.value = ' ' " id= "clear" >  

 <br>  

   

</form>  

</div>  

</body>  

</html>  

Explanation:

3 0
2 years ago
Wich command converts a number to a string​
AfilCa [17]

Answer:

okay yes i agree

Explanation:

8 0
3 years ago
Other questions:
  • What filter gives a “squeezed” effect to an image?
    14·2 answers
  • Prompt the user ‘Enter a row vector of any numbers’ in the command window, and enter an arbitrary row vector and store it to x.
    6·1 answer
  • What is the relationship between a method and a function
    11·2 answers
  • How can a user preview the playback of an audio clip in PowerPoint? Use the drop-down menus to complete the statements.
    14·1 answer
  • Imagine that the following two lines of code are placed inside a
    11·1 answer
  • python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. T
    12·1 answer
  • Ciscon Telecom is a mobile operator in the European Union. The company provides personalized services to its customers, and its
    8·2 answers
  • Last bittttt of points
    8·1 answer
  • When would you insert a merge field?
    10·2 answers
  • What might a designer need to consider when choosing an appropriate energy source for products and power systems
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!