[Python-ideas] List Comprehensions

Alexander Walters tritium-list at sdamon.com
Wed Feb 3 04:01:02 EST 2016


That is working exactly as expected.  You iterate over a tuple of a list 
(the range), and an int (100).

On 2/3/2016 03:34, shiva prasanth wrote:
> python input and output
>
> In [2]: z=[ x for x in range(10)]
>
> In [3]: z
> Out[3]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>
> In [4]: z=[x for x in range(10),100]  # should be [ 0 , 1, 2, 3, 4, 5, 
> 6, 7, 8, 9, 100]
>
>
> # but  output is not as expected
> # following is the output
> # other wise it should show error
>
> In [5]: z
> Out[5]: [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 100]
>
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160203/c0073ddd/attachment.html>


More information about the Python-ideas mailing list