Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions