[Python-ideas] List Comprehensions

shiva prasanth kesavarapu.siva at gmail.com
Wed Feb 3 03:34:53 EST 2016


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]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160203/6ff4de22/attachment.html>


More information about the Python-ideas mailing list