Sayth Renshaw wrote: > def output_data(s): > serie = fibo(input_length) > x = [] > y = [] > > for num1, num2 in pairwise(serie): > y.append( num2 / num1)
It looks like y contains unique values. In that case replace > for item in y: > x.append(y.index(item)) with x = list(range(len(x))) or use a single loop for index, (num1, num2) in enumerate(pairwise(serie)): x.append(index) y.append( num2 / num1) > draw_graph(x, y) > Kept trying with the enumerate style > for i, num in enumerate(serie): > while i < len(serie)-1: > x.append(int(serie[i + 1])/ int(serie[i])) > i += 1 There should be only one loop; use if ... to avoid the IndexError for i, num in enumerate(serie): if i < len(serie)-1: x.append(serie[i + 1]/ num) y.append(i) or clip the list: for i, num in enumerate(serie[:-1]): x.append(serie[i + 1]/ num) y.append(i) But I would definitely recommend pairwise(). -- https://mail.python.org/mailman/listinfo/python-list