
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Need to solve this without using lst[].

Transcribed Image Text:• Create a function to match the specifications
Use the if/else statements to detect a range
• Use lists to store the results
• Write a program to get the user input and call the custom function and produce the desired output
Instructions
Sahara desert explorers call us for help! They want to know some statistics about the temperature in Sahara,
but sometimes their thermometer fails to record the proper temperature. Help them to find which temperature
is from correct recordings and which is broken and calculate statistics on given data.
During the night, temperature in Sahara varies from -4 to -10 C. During the day, the temperature varies from 20
to 50 C.
Create a function check_input(temperature) that will return True if this temperature can be from Sahara
and False if it is from a broken thermometer (i.e., outside of the expected range).
Write a program to use the check_input to create a list of valid temperatures and compute their statistics:
1. Create a list, where you will store the "possible" temperatures. Let's say temperatures list.
2. Input five numbers one by one (in this case measurement is an integer, but great that you thought about
what type to convert!). For each value, check it with your function and if the function tells that it is the
possible temperature for Sahara - add this value to the temperatures list.
3. Find the minimum, maximum, and average temperature in temperatures and print it to match the
example below:
Example input
-10
-20
20
48
21
Example Output
The minimum value is -10,
the maximum value is 48,
the average value is 19.75.
Hints!
• If you wrote the code to work with one input value (including reading it) you can copy-paste it 5 times. Soon
we will learn how to do it easier and simpler.
• To calculate the minimum and maximum search for the function that we've learned in the List section. For
average think about sum and len functions.
• Average of some values is the sum of this values, divided by the number of values.
Troubleshooting
• If you are getting an error "TypeError: 'int' object is not subscriptable", check that your
function is expecting a single value as an input.

Transcribed Image Text:main.py
Load default template.
1 # Define your function here
2 def check_input (temperature):
if temperature >= -10 and temperature <= -4 or temperature >= 20 and temperature <= 50:
3
4
return True
5 if _name_ == '_main_':
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- What is the data in BX after SHR BX, CL if CL contains 6?arrow_forwardAdjacency matrix. Given a relation relation (as a numpy.array, see example below) and number of nodes n, define a function adjacency to construct the adjacency matrix A (as a numpy.array).You can assume that n is a positive integer and treat relation as a list of directed edges. # Example from p112 of VMLSrelation = np.array([[1, 2], [1, 3], [2, 1], [2, 4], [3, 4], [4, 1]])n = 4 # Modify the function adjacency below with your answer for Q8def adjacency(relation, n): A = None ########################### ### YOUR CODE HERE ######## ## REMOVE THIS LINE-------- raise NotImplementedError() ## ------------------------ ########################### return Aarrow_forwardHow can I insert, remove, and search nodes in a data structure with a time complexity that is less than O(n)?arrow_forward
- Question 5 Refer to the following graph and choose the option that reflects the row for node 3 of the D(2) matrix generated by the Floyd-Warshall Algorithm. If you are solving this programmatically, be careful about zero-based indices in most languages. The graph below has 1-based indexing. 1 O 32042-8 3 O-42 327620 -5 Infinity O 87 Infinity 9 0 Infinity O 0204-1-8 10 5 -8arrow_forwardWhat is the a(3) term of the sequence {a(n)} where a(n) = 2n - 6?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education