question archive When prompting the user you must always include text which lets the user know what should be inputted

When prompting the user you must always include text which lets the user know what should be inputted

Subject:Computer SciencePrice:3.87 Bought7

When prompting the user you must always include text which lets the user know what should be inputted.

Update the weather.py file to do the following:

  • Using separate prompts, prompt the user to enter the latitude of the weathe
  • r station and the longitude of the weather station
  • Use the latitude and longitude to retrieve the following information:
  • Station Name
  • Current Conditions eg. Sunny, Partly Cloudy etc.
  • Temperature in Fahrenheit
  • Elevation
  • Display the output as follows:

WEATHER.PY FILE:

 

import bs4, requests

 

try:

 

url = 'https://forecast.weather.gov/MapClick.php?'

 

latlong = 'lat=46.8837&lon=-102.7817'

 

# Combines url and zip

 

res = requests.get(url + latlong)

 

# Checks for error, and raises it as necessary

 

res.raise_for_status()

 

soup = bs4.BeautifulSoup(res.text, 'html.parser')

 

# Select for station

 

elems = soup.select('#current-conditions > div.panel-heading > div > h2')

 

# Retrieves station information and prints it out

 

stationName = elems[0].text

 

print(stationName)

 

except Exception as ex:

 

# Print out any error messages

 

print('There was a problem retrieving the information')

 

The following are some urls with the latitude and longitude of weather stations to test your program:

https://forecast.weather.gov/MapClick.php?lat=32.73016&lon=-117.19518

https://forecast.weather.gov/MapClick.php?lat=46.999&lon=-102.8833

https://forecast.weather.gov/MapClick.php?lat=33.417&lon=-111.8315

https://forecast.weather.gov/MapClick.php?lat=41.2607&lon=-95.9403

https://forecast.weather.gov/MapClick.php?lat=30.4391&lon=-81.703

https://forecast.weather.gov/MapClick.php?lat=41.3108&lon=-105.5903

Option 1

Low Cost Option
Download this past answer in few clicks

3.87 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 7 times

Completion Status 100%