Convert int to list in python
<p>Take a list, say for example this one:</p>

<pre><code>a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
</code></pre>

<p>and write a program that prints out all the elements of the list as the list [1,1,2,3,5] that are less than 5.
Currently it prints as </p>

<pre><code>1
1
2
3
5
</code></pre>

<p>My code </p>

<pre><code>a = [1,1,2,3,5,8,13,21,34,55,89]
count = 0
for i in a:
    if i&lt;=5:
        count+=1
        print(i)
</code></pre>

<p>You should have the if condition be more strict if you want only element smaller than 5. It should be <code>if i&lt;5:</code> instead of <code>i&lt;=5</code>.</p>

<p>If you want to store the elements in a new list, see the example below.</p>

<pre><code>a = [1,1,2,3,5,8,13,21,34,55,89]
new_list=[]
for i in a:
    if i&lt;5:
        new_list.append(i)
print new_list
</code></pre>

python