Question: create a code cell and copy the following code into it ( without the indentations ) . import random random.seed ( 1 2 ) random

create a code cell and copy the following code into it (without the indentations).
import random
random.seed(12)
random_list = random.sample(range(500),99)
This code will create a list named random_list that contains 99 randomly generated integers. We will discuss how this
code works later in the course.
Print the length of random_list. Use list slicing to display the first 10 elements of this list, all on the same line. Format
your output as follows:
Length of random_list: xxxx
First 10 Elements of random_list: xxxx
Use the sum() function to calculate the sum of the elements in random_list. Print the result in the format shown below.
Match the formatting exactly, including the period at the end of the sentence. There should be no space between the
sum and the period.
The sum of the elements in random list is xxxx.
Create a list named sorted_list that contains the same elements of random_list, sorted in increasing order. The
order of the elements in random_list should not be changed. Use slicing to print the first ten elements of both lists on
separate lines. Format your output as follows:
First 10 Elements of sorted_list: xxxx
First 10 Elements of random_list: xxxx
Create lists named bot_slice, mid_slice, and top_slice as follows:
bot_slice should contain the smallest 33 elements in sorted_list.
mid_slice should contain the middle 33 elements in sorted_list.
top_slice should contain the largest 33 elements in sorted_list.
Print the six messages shown below, with the appropriate numerical values inserted in place of the xxxx symbols. Include
the periods at the end of the sentences, and include blank lines between each pair of sentences, as shown.
The smallest element of bot_slice is xxxx.
The largest element of bot_slice is xxxx.
The smallest element of mid_slice is xxxx.
The largest element of mid_slice is xxxx.
The smallest element of top_slice is xxxx.
The largest element of top_slice is xxxx.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!