Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started