Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started