Question: there is a problem with this code in python please can you help to fix: Here is the picture of the problem: Here is the

there is a problem with this code in python please can you help to fix:

Here is the picture of the problem:

there is a problem with this code in python please can you

Here is the code:

import requests from datetime import datetime

def get_weather(api_key, location): url = "https://api.openweathermap.org/data/2.5/forecast?q={}&units=metric&appid={}".format(location, api_key) r = requests.get(url) return r.json()

def main(): f = open('output.txt', 'w') while True: location = input('Enter location: ') if location == 'EXIT': f.write('') f.close() return

api_key = '2b92ac90c161a8b52a86175509113de9' weather = get_weather(api_key, location)

prediction = weather['list'] f.write('location: ' + location + '') for day in prediction: s = '%-40s%.2f' % (str(datetime.datetime.fromtimestamp(day['dt'])), day['main']['temp']) f.write(s + '') print(s)

main()

Command Prompt icrosoft Windows [Uersion 6.3.96001 python.py File "C:\Users\saneer\Downloads\Programing languages C311xpython.py", line 1, Traceback (most recent call last>: import requests oduleNotFoundError No module named 'requests' NUserssameerDownloads Programing languages C311>

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!