Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

The two sublayers of the DLL are

Answered: 1 week ago

Question

To solve by the graphical methods 2x +3y = 9 9x - 8y = 10

Answered: 1 week ago

Question

Why does sin 2x + cos2x =1 ?

Answered: 1 week ago

Question

What are DNA and RNA and what is the difference between them?

Answered: 1 week ago

Question

Why do living creatures die? Can it be proved that they are reborn?

Answered: 1 week ago