Question: Using Python: Implement a function which will process the attached file and create a dictionary of the U.S. states and their capitals Implement a function

Using Python:

  1. Implement a function which will process the attached file and create a dictionary of the U.S. states and their capitals
  2. Implement a function (e.g. whats the capital of ) to Randomly quiz a user by displaying the name of a state and asking for the respective capital name
    • Inform user whether their response is correct (or provide the correct capital name)
    • Reuse the dictionary that you have created for the previous question
  3. Write another function to generate a word count (index of words & frequencies)
    • By processing a text file with a similar passage as the following
      • "Writing programs or programming is a very creative and rewarding activity. You can write programs for many reasons ranging from making your living to solving a difficult data analysis problem to having fun to helping someone else solve a problem. This book assumes that everyone needs to know how to program and that once you know how to program, you will figure out what you want to do with your newfound skills. We are surrounded in our daily lives with computers ranging from laptops to cell phones. We can think of these computers as our personal assistants who can take care of many things on our behalf. The hardware in our current-day computers is essentially built to continuously ask us the question what would you like me to do next? A computer is fast and has vast amounts of memory and could be very helpful to us if we only knew the language to speak to explain to the computer what we would like it to do next. If we knew this language, we could tell the computer to do tasks on our behalf that were repetitive. Interestingly, the kinds of things a computer can do best are often the kinds of things that we humans find boring and mind-numbing."
    • Index the list of words and their frequencies (for example the word to appears 7 times (I am making this up )
    • Sort the index (by frequency or alphabetize) and save it to a file (name) of your choice
    • Consider the above passage as the content of your input file (for testing purpose)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!