это мой код:
while counter <= len(titles):
currenttime = [perc[counter], fails[counter], titles[counter]]
print(currenttime)
for percent, fail, title in currenttime:
Когда я запускаю его, я получаю ошибку значения, показывающую
ValueError: not enough values to unpack (expected 3, got 2)
Но когда я печатаю текущее время ,Я получаю
['67', '1', 'subsection']
Для меня это выглядит как 3 значения, но, очевидно, я ошибаюсь, кто-то может меня просветить?Я осмотрелся вокруг, но не нашел хороших ответов, шофар.любая помощь будет принята с благодарностью.Спасибо
контекст кода:
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)