Question
1.Define a function which creates a dictionary where the keys are between the letters a and h, inclusive, and the values are square of keys
1.Define a function which creates a dictionary where the keys are between the letters a and h, inclusive, and the values are square of keys ordinal value (Hint: check an ASCII table). The function should return the dictionary back to the caller.
-Using the returned dictionary from your function, print the entire dictionary.
-Using the returned dictionary from your function, print only the values of the dictionary.
-Using the returned dictionary from your function, print only the keys of the dictionary.
2. Write a program, using Python dictionaries, that analyzes text documents and counts how many times each word appears in the document. This kind of analysis is some- times used as a crude measure of the style similarity between two documents and is also used by automatic indexing and archiving programs (such as Internet search engines). At the highest level, this is just a multi-accumulator problem. We need a count for each word that appears in the document.
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