Using Python, write a program that takes input keywords from a list to create a dictionary...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Using Python, write a program that takes input keywords from a list to create a dictionary which consists of all the keywords as keys and their count of occurrence as values. a) Define a main function and write all the logic inside this function. Do not forget the function call for the main function at the end of the program. [10% marks] b) Create a list named keywords List which consists of 20 python keywords. The list must contain duplicate values as well. Some examples of python keywords are: and del, global, while, for, in else, print, return, import, if elif, break, continue, etc. [20% marks] c) Create an empty dictionary named dictionary. The keywords from the list defined above will represent the keys and their respective count of occurrence will represent the values for the dictionary. [10% marks] d) Iterate through the list and increment the value of the current keyword for the dictionary. [25% marks] e) Sort the dictionary based on the count of occurrence of the keyword in descending order. (Hint: use python's sorted() in-built function to sort the dictionary) [25% marks] f) The expected output is given below: (Hint: use ljust() function to adjust the spacing for the output) [10% marks]. Keyword name is the name of the keyword selected from the list into the dictionary which acts as the key. count is the number of occurrences of the keyword in the list which acts as the value in the dictionary. Keyword_name Count print and 5 break del else while return import in continue not def elif 1443332222222 global 1 or if for Using Python, write a program that takes input keywords from a list to create a dictionary which consists of all the keywords as keys and their count of occurrence as values. a) Define a main function and write all the logic inside this function. Do not forget the function call for the main function at the end of the program. [10% marks] b) Create a list named keywords List which consists of 20 python keywords. The list must contain duplicate values as well. Some examples of python keywords are: and del, global, while, for, in else, print, return, import, if elif, break, continue, etc. [20% marks] c) Create an empty dictionary named dictionary. The keywords from the list defined above will represent the keys and their respective count of occurrence will represent the values for the dictionary. [10% marks] d) Iterate through the list and increment the value of the current keyword for the dictionary. [25% marks] e) Sort the dictionary based on the count of occurrence of the keyword in descending order. (Hint: use python's sorted() in-built function to sort the dictionary) [25% marks] f) The expected output is given below: (Hint: use ljust() function to adjust the spacing for the output) [10% marks]. Keyword name is the name of the keyword selected from the list into the dictionary which acts as the key. count is the number of occurrences of the keyword in the list which acts as the value in the dictionary. Keyword_name Count print and 5 break del else while return import in continue not def elif 1443332222222 global 1 or if for
Expert Answer:
Answer rating: 100% (QA)
Heres the Python program def main Create a list of Python keywords keywordslist and as assert async ... View the full answer
Related Book For
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord
Posted Date:
Students also viewed these programming questions
-
In 1946, when the employment Act was passed, economists and laymen alike believed that the avoidance of mass unemployment was the major economic problem facing the nation and that compensatory...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Create a conclusion to following work. Hotels form an uninterrupted narrative of a story, filling guests with emotions that define their stay. They have ceased to be considered one-dimensional places...
-
93) Clay of the Land is a manufacturer of glazed clay pots. Currently, it produces 300 clay pots per month which it sells through nurseries at a constant price of $5 per pot. Current demand for clay...
-
1. What is your impression of an "employee first" culture? Would this work in other organizations? Why or why not? What would it take to make it work? 2. How might an understanding of organizational...
-
Are fraudulent financial statements a great problem in government units?
-
How can team communications be improved?
-
Prior to instituting an activity-based costing system, O'Reilly and Shriberg, the attorneys in E9-6 and E9-7, utilized a simplified costing system with one direct cost category, professional labor,...
-
February2021Transactions:Notes:February Paydays:12thand 26th.How many days of wage accrual for February?F-1 -On February 1, 2021, received cash into the bankaccount from thecredit card processing...
-
The price of Cilantro, Inc., stock will be either $60 or $80 at the end of the year. Call options are available with one year to expiration. T-bills currently yield 6 percent. a. Suppose the current...
-
1. A helicopter can hold a maximum of 8 people or 1000 pounds. A group of 7 people want to know if they can take a ride. Which measure of central tendency in relation to the group's weight could you...
-
Motivating your partners along the distribution channel can be critical in order to get your product delivered timely and sold. If you were a marketing manager in charge of setting up the channels of...
-
Aliabilityis a future obligation and acurrent liabilityis a future obligation that is due within 1 year. A contingency can result in a gain or loss. What are the criteria to determine whether to...
-
1. Bellingham Company produces a product that requires16 standard pounds per unit. The standard price is $9.5per pound. If 3,300 units used 51,200 pounds, which were purchasedat $9.69 per pound, what...
-
Explore the key principles and design strategies in geotechnical earthquake engineering. How are seismic hazard analyses conducted, and what measures are taken to enhance the resilience of...
-
The following table depicts the number of computer printers produced by Hewlett-Packard at various level of labor input per week. Assume the printers sell for $100 each. Calculate the marginal...
-
prepare journal entries for both Simmons Company purchased merchandise from Crystal Inc. with an invoice price of $168,000 and credit terms of 2/15, n/30. The merchandise had cost Crystal, Inc. an...
-
Identify the source of funds within Micro Credit? How does this differ from traditional sources of financing? What internal and external governance mechanisms are in place in Micro Credit?
-
True or False: SESAME is an authentication system that is the result of a European research and development project and is similar to Kerberos.
-
Review how once an IDPS detects an anomalous network situation, it has several options, depending on the policy and objectives of the organization that has configured it as well as the capabilities...
-
Conclude that the most critical component of an IR plan is to stop the incident and contain the scope and/or impact to the organization. With time being of the essence, detailed analyses here are not...
-
Feng Company installs a computerized manufacturing machine in its factory at the beginning of the year at a cost of $42,300. The machines useful life is estimated at 10 years, or 363,000 units of...
-
In early January 2004, LabTech purchases computer equipment for $147,000 to use in operating ac tivities for the next four years. It estimates the equipments salvage value at $30,000. Prepare tables...
-
Cemer Manufacturing purchases a large lot on which an old building is located as part of its plans to build a new plant. The negotiated purchase price is $225,000 for the lot plus $120,000 for the...
Study smarter with the SolutionInn App