How to obtain the nth row of the pascal triangle
<p>Here is my code to find the nth row of pascals triangle</p>

<pre><code>def pascaline(n):
     line = [1]       
     for k in range(max(n,0)):             
         line.append(line[k]*(n-k)/(k+1))             
     return line
</code></pre>

<p>There are two things I would like to ask. First, the outputs integers end with .0 always like in </p>

<pre><code>pascaline(2) = [1, 2.0, 1.0]
</code></pre>

<p>How do I remove those .0 at the end? also, how can I do to start at $n=1$ and not at $0$? For instance, in this case, pascaline(2) should be [1, 1] and not [1, 2, 1]</p>

<p>the .0 can be removed by taking the floor division using <code>//</code> instead of float division with <code>/</code> so your code would be <code>line.append(line[k]*(n-k)//(k+1))</code>. To get it to start one back just make n one less with <code>n -= 1</code>.</p>

<pre><code>def pascaline(n):
     n -= 1
     line = [1]
     for k in range(max(n,0)):             
         line.append(line[k]*(n-k)//(k+1))             
     return line


pascaline(2) &gt;&gt;&gt; [1,1]
</code></pre>

python