Q:

Python 'float' object is not iterable error

Error message: 

File "C:/Users/artisan/PycharmProjects/API connection/polo.py", line
  12, in poloniexapi
      total = sum([int(num) for num in i["quoteVolume"]]) TypeError: 'float' object is not iterable

import requests
import json, requests
import _json

def poloniexapi(url):
    response = requests.get(url)
    json_obj = json.loads(response.text)

    for i in json_obj:
        print(i["quoteVolume"])

    total = sum([int(num) for num in i["quoteVolume"]])

poloniexapi("https://poloniex.com/public?command=returnChartData&currencyPair=BTC_XMR&start=1405699200&end=9999999999&period=86400")

Appreciate all help :)

A:

for num in i['quoteVolume'] is trying to iterate over i['quoteVolume']. But this is just one number (the last number from the previous for loop), not a list. I think what you want is:
total = sum([int(i["quoteVolume"]) for i in json_obj])

