Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem A [50 Marks]: Solve the following questions using pydhon only. a. Create a dictionary where words (all contiguous characters) from Textl are keys, and
Problem A [50 Marks]: Solve the following questions using pydhon only. a. Create a dictionary where words (all contiguous characters) from Textl are keys, and A-1. Create a list L1 containing numbers from 15 to 24 (24 exclusive), using LIST words from Text2 are values. COMPREIIENSION (do not use list function or usual FOR loop). Sort the list in ascending order. b. Is there aby differenes in the total number of words in Text1 and the total number of keys Create a new list I.2 from L.I using I.IST COMPREHINSION, where the elements of I.I and in the above dietionary? If yes, then explain the feason for the differcnoe. L 2 are related as follows: A-5. A-5: Create a tandon integer numpy two-dimensional atray of size 59, where the integer values range from 1 to 100 (100 ibclusive). Set the random generator seed to be 26. Call the array as S. Print the dimensions, sbapc, and size of S. A-6. Print alternate columns starting from columin indexed 3 and all the rows of S. (4 marks) A-7. Create a new numpy array M1 that contains third-row elements of S in order of column 8 , then A-2. Let B=/61,25,36,21,58,101,254,200J be a list. Apply the following function (x22 5, then 3, then 1. Similarly, create a new array M12 that contsins fourth-row elements in onder of (x+2))//50 on each element of B. Dont use FOR loop! column 9 , then colurmn 7 , then column 2 , then 8 . (4 marks) array by vertically joining M2 below M11. A-3. Consider the following text: A-9. Create a copy of S, say P. Sort the elements in the even columns of P (that is, in aach ewen coluwn, the smalfest element is in the first row, and the largest in the last rowi. Print both S and mlgarme yvegui gezm gsv sziw diip. " P. (4 murks) a. Create a list of words (all coutiguvus characters) in the order of their appenance. A-10. Add the following arruy /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 berween 20 and 60 . (8 murks) (4 marks) A-4. Consiber the following texts: iwhimb gsag wigsrnt yngvi gsem gsv sziw dip, gsv xighe ximgzrm 4 sinhdiph" Text2- "welcume lo ise 291 it will be a really interesting cowere, do yeur best and remember that nothing herter than the hard work, the course contain 4 hameworks
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