Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A-1. [5 marks]: Create a list L1 containing numbers from 33 to 99 (inclusive), using LIST COMPREHENSION (do not use list function or usual

A-1. [5 marks]: Create a list L1 containing numbers from 33 to 99 (inclusive), using LIST COMPREHENSION (do

A-1. [5 marks]: Create a list L1 containing numbers from 33 to 99 (inclusive), using LIST COMPREHENSION (do not use list function or usual FOR loop). Sort the list in descending order. Create a new list L2 from L1 using LIST COMPREHENSION again, where the elements of L1 and L2 are related as follows: L2=[] for i, e in enumerate (L1): if e%2==0: if e>i: L2.append(e+i) L2.append(e*i) else: A-2. [5 marks]: Let B = [121, 86, 200, 21, 6, 33, 99] be a list. Apply the function (x** 2-(x-20)) // 33 on each element of B and print the new elements of B. Don't use any form of FOR loop! A-3. [3 marks]: Consider the following text: text= """dvoxlnv gl rhv 291 rg droo yv z ivzoob rmgvivhgrmt xlfihv, wl blfi yvhg zmw ivnvnyvi gszg mlgsrmt yvggvi gszm gsv sziw dlip. Create a list of words (all contiguous characters) in the order of their appearance. Remove newline characters (if any) from the list. A-4. Consider the following texts: Text1="""dvoxlnv gl rhv 291 rg droo yv z ivzoob rmgvivhgrmt xlfihy, wl blfi yvhg zmw ivnvnyvi gszg mlgsrmt yvggvi gszm gsv sziw dlip, gsv xlfihv xlmgzrm 4 slnvdliph"" 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. [3 marks]: Create a dictionary where words (all contiguous characters) from textl are keys, and words from text2 are values. b. [3 marks]: 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.

Step by Step Solution

3.33 Rating (126 Votes )

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

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Per Roberson, some characteristics of closed end funds are:

Answered: 1 week ago