Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BlockPy: #48.2) Dracula Appears Project Gutenberg has a large number of classic books available, including the complete text of Dracula. Access the URL using the

BlockPy: #48.2) Dracula Appears Project Gutenberg has a large number of classic books available, including the complete text of Dracula. Access the URL using the requests module and the get function in order to count the number of times that "Dracula" appears in the story. Note that you may use the built-in count method of strings. Make sure you use this URL exactly in your code: 'http://www.gutenberg.org/cache/epub/345/pg345.txt'

BlockPy: #48.3) Live Temperatures

Live web feeds are an exciting way to make your programs respond to the world around them. In this problem, you will print out the current temperature for Blacksburg, Virginia. This data is available from the US Geological Service's Weather Forecast data stream. The URL below (note that it is one line, with no spaces or new lines) gives you access to the current information about Blacksburg weather:

"http://forecast.weather.gov/MapClick.php?lat=37.2327&lon=-80.4284&unit=0&lg=english&FcstType=json"

Use this URL and the requests module to access the JSON data behind the URL. This JSON data is organized as a dictionary of dictionaries of lists. The current temperature can be found by accessing the "data" key, then the "temperature"key, and then retrieving the first element of the subsequent list. Print that first temperature value.

Repeatedly accessing a real-world website like Forecast.gov is a little rude, especially if we all do it at once. Therefore, for this problem, we have captured a snapshot of the temperature. If you want to try your code in Spyder or Thonny, however, you should be able to see the actual temperature!

Note: Do not use the json module; use the json method of the response object.

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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

What is a global industry?

Answered: 1 week ago