Using Python: This assignment requires the main function and a custom value-returning function. The value-returning function takes a list of random Fahrenheit temperatures as its only argument and returns a smaller list of only the temperatures above freezing. This value-returning function must use a list comprehension to create the list of above freezing temperatures. In the main function, code these steps in this sequence: create an empty list that will the hold random integer temperatures. use a loop to add 24 random temperatures to the list. All temperatures should be between 10 and 55, inclusive. Duplicates are okay. sort the list in ascending order. use another loop to display all 24 sorted temperatures on one line separated by spaces. 32 could be in the list. If it is, report the index of the first instance of 32. if 32 isn't in the list, add it at index 4. assign a slice consisting of the first six temperatures to a new list. Then print it. execute the custom value-returning function with the complete list as its only argument. in the main function, report the coldest temperature in the list that was returned. sort the list of above freezing temperatures in high to low order use a loop to display all above freezing temperatures on one line separated by spaces.
Using Python: This assignment requires the main function and a custom value-returning function. The value-returning function takes a list of random Fahrenheit temperatures as its only argument and returns a smaller list of only the temperatures above freezing. This value-returning function must use a list comprehension to create the list of above freezing temperatures. In the main function, code these steps in this sequence: create an empty list that will the hold random integer temperatures. use a loop to add 24 random temperatures to the list. All temperatures should be between 10 and 55, inclusive. Duplicates are okay. sort the list in ascending order. use another loop to display all 24 sorted temperatures on one line separated by spaces. 32 could be in the list. If it is, report the index of the first instance of 32. if 32 isn't in the list, add it at index 4. assign a slice consisting of the first six temperatures to a new list. Then print it. execute the custom value-returning function with the complete list as its only argument. in the main function, report the coldest temperature in the list that was returned. sort the list of above freezing temperatures in high to low order use a loop to display all above freezing temperatures on one line separated by spaces.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Using Python:
This assignment requires the main function and a custom value-returning function. The value-returning function takes a list of random Fahrenheit temperatures as its only argument and returns a smaller list of only the temperatures above freezing. This value-returning function must use a list comprehension to create the list of above freezing temperatures.
In the main function, code these steps in this sequence:
- create an empty list that will the hold random integer temperatures.
- use a loop to add 24 random temperatures to the list. All temperatures should be between 10 and 55, inclusive. Duplicates are okay.
- sort the list in ascending order.
- use another loop to display all 24 sorted temperatures on one line separated by spaces.
- 32 could be in the list. If it is, report the index of the first instance of 32.
- if 32 isn't in the list, add it at index 4.
- assign a slice consisting of the first six temperatures to a new list. Then print it.
- execute the custom value-returning function with the complete list as its only argument.
- in the main function, report the coldest temperature in the list that was returned.
- sort the list of above freezing temperatures in high to low order
- use a loop to display all above freezing temperatures on one line separated by spaces.
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 now
This is a popular solution!
Step by step
Solved in 2 steps with 2 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.Recommended textbooks for you
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
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