Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem A [50 Marks]: Solve the following questions using python unly. a. Create a dictionary where words (all contiguous characters) from Tcxtl are keys, and

image text in transcribed

Problem A [50 Marks]: Solve the following questions using python unly. a. Create a dictionary where words (all contiguous characters) from Tcxtl are keys, and words from Text2 are values. A-1. Create a list L1 containing numbers from 15 to 24 (24 exclusive), using L.ISI b. Is there any difference in the total number of words in Textl and the total number of keys COMPREHENSION (do not use list function or usual FOR. loop). Sort the list in ascending order. in the above dictionary? If yes, thea explain the reason for the difference. Create a new list I.2 frum I.1 using LIST COMPREIIENSIOV, where the elements of I.1 and L2 are related as follows: A-5. A-5: Caeate a random integer numpy two-dimensional array of size 59, where the integer values range from 1 to 100 (100 inclusive). Set the random generatur 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 murks) A-7. Create a new numpy amay M1 that contains thind-row elements of S in order of columu 8 , then A-2. Let B{61,25,36,21,58,101,254,200} he a list. Apply the following function (x2 5, then 3, then 1. Similarly, create a new array M2 that contains fourth-row elements in order of (x+2))//50 on each element of B. Don't use FOR loop! column 9 , then column 7 , then column 2 , then 8 . (4 warks) A-8. Create a new one-dimensional array by joining M1 and M2. Create another new two-dimensional array by vertically joining M2 below M11. A-3. Consider the following text: A-9. Create a copy of 8, say P. Sort the elements in the even columns of P (that is, in each even column, the smallest element is in the first row, and the langest in the fast row). Print both S and migsmi yvggri gsam gsv sziw dip." P. a. Crente a list of words (all contiguous characters) in the order of their appearance. A-10. Add the following amay [1,2,3,4,5,6,7,8,9] to all the rows of P. Print all the elements of updated Remove newline characters (if any') from the list. P that are strictly between 20 and 60 . (8 warhs) A-4. Consider the following lexts: TextI - "dvaxiv gl rhv 241rg droo yv z vaob rmgwivhgrme xifihv, wi bifi ywg zmw Text 2=n welcone to ise 291 it will be a really interesting cosire, do your best and remember that nothing better than the hard work, the course contain 4 homeworks N

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions