Alternate for range in python
<p>If I have to generate natural numbers, I can use 'range' as follows:</p>

<pre><code>list(range(5))
</code></pre>

<p>[0, 1, 2, 3, 4]</p>

<p>Is there any way to achieve this without using range function or looping?</p>

<p>You could use recursion to print first n natural numbers</p>

<pre><code>def printNos(n):

    if n &gt; 0:

        printNos(n-1)
        print n

printNos(100)
</code></pre>

python