Question: Q5: List Operations (20 points) You will first generate a list of 10 random integers from 1 to 1000 by using the Python random module.

 Q5: List Operations (20 points) You will first generate a list

Q5: List Operations (20 points) You will first generate a list of 10 random integers from 1 to 1000 by using the Python random module. Save the list (let's call it A) and write a short snippet for each of the following task: 1. Pick and sort first the odd numbers then the even numbers in ascending order and print the final list, e.g. [1 35141632] 2. Extract only the items that are less than 250. 3. Create a new list where each item y is the square of the correpsonding item in A. 4. Extract the items that are NOT divisible by 3 and NOT divisible by 7 ]: import random \# Note: you can use random. randint() to generate the random integers ]:#Q2_1 ]:#Q2_2 ]:#Q2_3 ]:#Q2_4

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!