this is my code:
while counter <= len(titles):
currenttime = [perc[counter], fails[counter], titles[counter]]
print(currenttime)
for percent, fail, title in currenttime:
When I run it, I get a value error showing
ValueError: not enough values to unpack (expected 3, got 2)
But when I print current time, I get
['67', '1', 'subsection']
To me, this looks like 3 values, but obviously I am wrong, could someone enlighten me? I've had a look around, but have found no good answers shofar. any help would be greatly appreciated. Thanks
code context:
n = 0
perc = list()
while n < len(piedata):
perc.append(piedata[n+2])
n += 3
print (perc)
n = 0
fails = list()
while n < len(piedata):
fails.append(piedata[n+1])
n += 3
print(fails)
n = 0
titles = list()
while n < len(piedata):
titles.append(piedata[n])
n += 3
print(titles)
counter = 0
while counter <= len(titles):
currenttime = [perc[counter], fails[counter], titles[counter]]
print(currenttime)
for percent, fail, title in currenttime:
piedata = [percent, (100-percent)]
fig = matplotlib.figure.Figure(figsize=(5, 5))
ax = fig.add_subplot(111)
ax.pie(piedata) # this is the information that the circle diagram will be made out of
ax.legend([('amount of attempts:', NOTT), ('amount of fails', fail)])
circle = matplotlib.patches.Circle((0, 0), 0.7, color='white')
ax.add_artist(circle)
# this is the code for actually putting the circle diagram/pie chart on the screen
canvas = FigureCanvasTkAgg(fig, master=window)
canvas.get_tk_widget().pack()
canvas.draw()
Label(window, text=(title, title), bg='light blue').pack()
counter += 1
window.mainloop()
print(percent)
print(fail)