Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

solve all parts please.. Problem A [50 Marks]: Solve the following questions using python only. A-1. Create a list L1 containing numbers from 15 to

solve all parts please..
image text in transcribed
image text in transcribed
Problem A [50 Marks]: Solve the following questions using python only. A-1. Create a list L1 containing numbers from 15 to 24 (24 exclusive), using LIST COMPREHENSION (do not use list function or usual FOR loop). Sort the list in ascending order. Create a new list L2 from L1 using LIST COMPREHENSION, where the elements of LI and L2 are related as follows: L2=[] for i,e in enumerate(L1): if ex:=1: if e)i: L2. append(e+i) else: L2. append(e*i) A-2. Let B=[61,25,36,21,58,101,254,200] be a list. Apply the following function (x2 (x2))//50 on each element of B. Don't use FOR loop! (4 marks) A-3. Consider the following text: "dvoxlnv gl rhv 291 rg droo yv z ivzoob rmgvivhgrmt xlfihv, wl blfi ywg amw ivmnywi gxzg mlgsrmt yvggi gszm gsv sziw dlip." a. Create a list of words (all contiguous characters) in the order of their appearance. Remove newline characters (if any) from the list. (8 marks) A-4. Consider the following texts: Textl=" dvoxinv gl hh 291 rg droo yv z ivzoob rmgvivhgrmt xlfihv, wl blfi ywh zmw ivnvnyvi gszg migsrmt yvggvi gsem gsv sziw dlip, gsv xlfihv xlngzerm 4 slnvalliph" Text2 = "welcome to ise 291 it will be a really interesting course, do your best and remember that nothing better than the hard work, the course contain 4 homeworks" A-4. Consider the following texts: Text2- " waccome to ise 291 it will be a really interesting course, do your best and remember that mothing betfer than she hard work the coserse contain 4 homeovorks" Page 2 of 6 E-291: Homework 01 a. Create a dictionary where words (all contiguous chamcters) from Textl are keys, and words from Text2 are values. b. Is there any difference in the total number of words in Text1 and the total number of keys in the above dictionary? If yes, then explain the reason for the difference. (le ararhy) A-5. A-5: Create a random imeger nampy two-dimensional array of size 5x9, where the integer values range from 1 to 100 ( 100 inclusive). Set the random generator seed to be 26. Call the array as S. Print the dimensions, shape, and size of S. A-6. Print alternate columns starting from column indexed 3 and all the rows of S. (4 marksy) (3 marhx) A-7. Create a new numpy array M1 that contains thind-row elements of S in order of column 8 , then 5, thea 3, then 1. Similarly, create a new array M2 that contains fourth-row elements in order of column 9 , then columan 7 , then column 2 , then 8 . (4 anarks) A-8. Create a new one-dimensiceal array by joining M11 and M2. Create another new two-dimensional array by vertically joining M2 below M11. (4 marks) A-9. Create a copy of S, say P. Sort the clements in the even columns of P (that is, in each even colunw, the smallest element is in the first ron, and the fargest in the lasd row). Print both S and P. (4 awarks) A-10. Add the following array /1,2,3,4,5,6,7,8,9/ to all the rows of P. Print all the elements of updated P that are strictly betwoen 20 and 60

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago