Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to figure out how to do that averages from json file after getting them. I have the following code, but it keeps

I am trying to figure out how to do that averages from json file after getting them. I have the following code, but it keeps giving me the following error: TypeError: can only concatenate str (not "float") to str

Below is the code (url replaced with "url")

import urllib.request import json

zipcode_list = ["72714","71640","72454","71834","72223","72110"] for one_zipcode in zipcode_list: link = "url" f = urllib.request.urlopen(link) data = f.read() weather = json.loads(data) n = (weather["name"]) x = (weather["main"]["temp"]) fh = (x-273.1)*9/5+32 total = round(fh, 2) print (n, ":", total, "Farenheit") avg = (n + x)/6 print(avg)

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions