Making a for loop print with an index
<p>I made a program which displays a user-provided number of the fibonacci series. I wanted to format it into an indexed list, but I don't what could I use to do so. I found the enumerate() function, but seems it only works for premade lists, whereas mine is generated accordingly to the user. </p>

<p>Do I use a for loop to generate a variable along with the series, then put the variable in the for loop that prints the numbers, like so: </p>

<pre><code>print("{0}. {1}".format(index_variable, wee(n)))
</code></pre>

<p>or am I going an entirely wrong road here?</p>

<pre><code>def fib(n):
    x = 0
    y = 1
    for i in range(n):
        yield y
        tmp = x
        x = y
        y += tmp

def main():
     n = input('How many do you want: ')
     for i, f in enumerate(fib(n)):
         print("{0}. {1}".format(i, f)
</code></pre>

<p>Make  a generator that yields the values you want and then pass that to <code>enumerate</code> </p>

python python-3.x object format string-formatting