This program in python that requires two functions. In the main function: create an empty list. use a loop to add twelve random integers, each in the range 1 to 50 inclusive, to your list. Duplicates are okay. sort the list in descending order. use slice syntax to create a sub-list of the largest three integers. create another sub-list slice holding the smallest three integers. print both of the above sub-lists. Crude "dumps" that display [ ] and commas are okay. call a custom, void function named show_list that takes your entire list as an argument. In the show_list function: use a loop to display all twelve integers on one line separated by a single space. report the total of all integers in the list. Sample OutputThe largest three integers are [44, 41, 38]The smallest three integers are [18, 12, 1]Here are all of the integers, sorted highest to lowest...44 41 38 37 37 34 25 21 21 18 12 1The sum of all integers in the list is 329
This program in python that requires two functions. In the main function: create an empty list. use a loop to add twelve random integers, each in the range 1 to 50 inclusive, to your list. Duplicates are okay. sort the list in descending order. use slice syntax to create a sub-list of the largest three integers. create another sub-list slice holding the smallest three integers. print both of the above sub-lists. Crude "dumps" that display [ ] and commas are okay. call a custom, void function named show_list that takes your entire list as an argument. In the show_list function: use a loop to display all twelve integers on one line separated by a single space. report the total of all integers in the list. Sample OutputThe largest three integers are [44, 41, 38]The smallest three integers are [18, 12, 1]Here are all of the integers, sorted highest to lowest...44 41 38 37 37 34 25 21 21 18 12 1The sum of all integers in the list is 329
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
Related questions
Question
This program in python that requires two functions. In the main function:
- create an empty list.
- use a loop to add twelve random integers, each in the range 1 to 50 inclusive, to your list. Duplicates are okay.
- sort the list in descending order.
- use slice syntax to create a sub-list of the largest three integers.
- create another sub-list slice holding the smallest three integers.
- print both of the above sub-lists. Crude "dumps" that display [ ] and commas are okay.
- call a custom, void function named show_list that takes your entire list as an argument.
In the show_list function:
- use a loop to display all twelve integers on one line separated by a single space.
- report the total of all integers in the list.
Sample Output
The largest three integers are [44, 41, 38]
The smallest three integers are [18, 12, 1]
Here are all of the integers, sorted highest to lowest...
44 41 38 37 37 34 25 21 21 18 12 1
The sum of all integers in the list is 329
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 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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning