Write a program as follows. Follow instructions carefully to avoid point deductions. All statements should be in the main function:create an empty list named nums.use a loop to add 20 random integers, all in the range from 1-100, to nums.print the total of all list elements.print the highest number in the list.print the lowest number in the list.sort the list and then reverse it.use another loop to display the sorted numbers in descending order, all on the same line, separated by a single space.determine if 75 is in the list. If it is, report the index of its first occurrence. If it is absent from the list, indicate that, too.make a new list named middle_10 by slicing out the middle 10 elements of the descending list. Use a loop to display the elements in middle_10 all on one line.make an empty list named evens and another empty list named odds.use a loop to process nums, adding even elements and odd elements to their respective lists.print both evens and odds. Crude dumps inside [ ] as shown next are okay.Sample Output 1List total: 712Highest number: 85Lowest number: 2All list elements in descending order85 83 67 67 58 53 50 49 30 28 23 21 20 20 16 15 14 8 3 275 not in the listMiddle 10 after descending sort: 53 50 49 30 28 23 21 20 20 16Even #s [58, 50, 30, 28, 20, 20, 16, 14, 8, 2]Odd #s [85, 83, 67, 67, 53, 49, 23, 21, 15, 3]Sample Output 2List total: 1000Highest number: 99Lowest number: 2All list elements in descending order99 98 87 85 78 75 72 71 54 48 47 35 31 29 25 20 18 16 10 2First found 75 at index 5Middle 10 after descending sort: 75 72 71 54 48 47 35 31 29 25Even #s [98, 78, 72, 54, 48, 20, 18, 16, 10, 2]Odd #s [99, 87, 85, 75, 71, 47, 35, 31, 29, 25]
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.