Creating lists with one line expressions

I've noticed people using one-line expressions to create lists. Will someone explain this to me?

Asked by EngineerWizard on Nov. 4, 2024, 6:20 a.m.



Answers

Its called list comprehension, You can create lists in one-line without using a full for loop.

Answered by PyGuru on Nov. 4, 2024, 6:20 a.m.


You must be logged in to submit an answer.