A-1. [5 marks]: Create a list L1 containing numbers from 33 to 99 (inclusive), using LIST...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
You purchased a 180 day T-bill with a face value of $100,000, 120 days after it was issued. The market yield when you purchased it was 3%. What was the price you paid for the T-bill? Price you paid...
-
In the last chapter you modified some tables for the Snick's Board Shop. Now Caitlin would like you to help her create some queries to extract information from the database. Make the following...
-
In the last chapter you modified some tables for the Wine Depot. Now Barbara would like you to help her create some queries to extract some information from the database. Make the following changes...
-
Write C++ statements to do the following. a. Declare int variables num1 and num2. b. Prompt the user to input two integers. c. Input the first number in num1 and the second number in num2. d. Output...
-
Suppose the force constant of the spring is doubled, but the mass and speed of the block are still 0.980 kg and 1.32 m/s, respectively. (a) By what multiplicative factor do you expect the maximum...
-
How would a shift from a tight credit policy to a relaxed policy be likely to affect a firms cash budget?
-
What determines the adequate grid step in LES far from the walls?
-
The budget director of Royal Furniture Company requests estimates of sales, production, and other operating data from the various administrative units every month. Selected information concerning...
-
Please show me how to get the correct answer Low-regular??and??extra dividend policy Bennett Farm Equipment Sales, Inc. is in a highly cyclicat business Although the firm has a target payout ratio...
-
Bottle-Up Inc., was organized on January 7, 2008, and made its S election on January 24, 2008. The necessary consents to the election were filed in a timely manner. Its address is 1234 Hill Street,...
-
List three reasons why projects fail despite project managers and team planning for the project
-
ABC Corporation produces a product that requires 2.6 pounds of materials per unit. The hourly wage rate is $9.00 per hour, but a raise that will average $0.25 will go into effect soon. Payroll taxes...
-
Everland Caf is a cafe spread across various locations, where they are famous for their coffee and pastries. In carrying out its operational activities it is known that the fixed cost for the cafe is...
-
Reference: https://serialpodcast.org/season-one/1/the-alibi Think of someone in your life who you think would be a good criminal defense attorney or other member of a defense team. Please answer the...
-
Discuss the advantages and disadvantages of the standard costing system from the perspective of the accounting professional and from the perspective of the company's other internal users.
-
Consider the health care environment in which you currently work or plan to work, and select a specific health care organization within that setting to focus on for this assignment. Possible options...
-
Cycle menus are those menus that: Question 5 options: consist of at least one or more weeks that repeat are most appropriate for commercial restaurants remain consistent from day to day follow a...
-
(a) What do data breach notification laws require? (b) Why has this caused companies to think more about security?
-
John Williams (age 42) is a single taxpayer, and he lives at 1324 Forest Dr., Reno, NV 89501. His Social Security number is 555-94-9358. John's earnings and withholdings as the manager of a local...
-
Walter, a single taxpayer, purchased a limited partnership interest in a tax shelter in 1985. He also acquired a rental house in 2012, which he actively manages. During 2012, Walter's share of the...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. Ivan and Irene have the following investment income, in addition to that reported in Chapter 1: Dividends...
-
A company maintains its fixed assets at cost. Depreciation provision accounts, one for each type of asset, are in use. Machinery is to be depreciated at the rate of 12% per cent per annum, and...
-
A company starts in business on 1 January 19X3, the financial year end being 31 December. You are to show: (a) The machinery account. (b) The provision for depreciation account. (c) The balance sheet...
-
A company depreciates its plant at the rate of 20 per cent per annum, straight line method, for each month of ownership. From the following details draw up the plant account and the provision for...
Study smarter with the SolutionInn App