flask - Python web app getting valueerror 0 not in list -


@app.route('/') def index():     tpopdloads = popdloads     tpopshipped = popshipped     locpopdload = []     locpopshipped = []     popdinfo = []      popsinfo = []     popdloadsord = sorted(tpopdloads, reverse=true)     popshippedord = sorted(tpopshipped, reverse=true)     in range(3):         locpopdload.append(tpopdloads.index(popdloadsord[i]))         popdinfo.append(dproducts[locpopdload[i]])         tpopdloads[tpopdloads.index(popdloadsord[i])] = -1 #problem line#      in range(3):         locpopshipped.append(tpopshipped.index(popshippedord[i]))         popsinfo.append(sproducts[locpopshipped[i]])         tpopshipped[tpopshipped.index(popdloadsord[i])] = -1      return render_template('index.html', popdinfo=popdinfo, popsinfo=popsinfo) 

the error i'm getting is:

  file "/var/lib/openshift/5697165a0c1e66eb870000fb/app-root/runtime /repo/flaskapp.py", line 47, in index tpopshipped[tpopshipped.index(popdloadsord[i])] = -1 valueerror: 0 not in list 

this using 2 variable popdloads , popshipped both lists contain set of integers. don't see why it's not working trying find actual index of number after list has been ordered. works when numbers zero, it's after change numbers in piece of code run problems.

the error telling why code isn't working. 0 isn't in list tpopshipped.

>>> [1,2,3].index(0) traceback (most recent call last):   file "<stdin>", line 1, in <module> valueerror: 0 not in list 

Comments