List Indices must be Integers? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: List Indices must be Integers? (/thread-8159.html) |
List Indices must be Integers? - midnitetots12 - Feb-07-2018 I'm trying to plot a list of the the outputs as a list with the corresponding time values, for this function with a varied number of iterations. I'm not sure why I keep getting "List Indices must be Integers" however. Was wondering if anyone could look at my code and see what's wrong and how I might fix it. def iterate3(finaltime2,stepsize): g(x) = 10*e^(0.05*x) count = srange(0,finaltime2/stepsize) initialvalat0 = [10] for i in count: a = g(initialvalat0[i]) initialvalat0.append(a) return zip(srange(0,finaltime2/stepsize),initialvalat0) graph4 = iterate3(10,0.1) graph5 = iterate3(100,0.1) graph6 = iterate3(100,0.01) list_plot(graph4) RE: List Indices must be Integers? - micseydel - Feb-07-2018 You need to provide: (1) the stacktrace for your problem and (2) the full code that produces that stacktrace. Ideally you provide a minimal amount of code for the problem you're having (5-10 lines, rather than your full project), but (1) and (2) are essential to us providing help. |