Append To An Empty List Using A Single Line For-loop Python


Answer :

Write a proper comprehension, without append.

>>> [i for i in range(10)] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> list(i for i in range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 

Comments

Popular posts from this blog

Chemistry - Bond Angles In NH3 And NCl3

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?