Code Learning#PYTHON#9420
Back
List creation variations
Lists can be created by direct declaration of values that go into it using square brackets. Constructor based creation can also be used.
Source Code
Run Output
Notes
- The constructor based creation takes any sequence (list, tuple or range) input and creates a list out of it. The same input can be given in a literal form or by way of taking the user input.
- The original iterable is not changed when
listis used to create a list from it.
