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....


This program in python that requires
two functions. In the main function:



  • create an empty list.

  • use a loop to addtwelve randomintegers, each in the range1 to 50 inclusive, to your list. Duplicates are okay.

  • sort the list indescending order.

  • useslice syntax to create a sub-list of thelargest three integers.

  • create another sub-listslice holding thesmallestthree integers.

  • print both of the above sub-lists. Crude "dumps" that display [ ] and commas are okay.

  • call a custom,void function namedshow_list that takes your entire list as an argument.


 In the show_list function:



  • use a loop to display all twelve integerson one lineseparated 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



Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here