Lists in Python



Python List

  • List is collection of heterogeneous object where insertion order is preserved and duplicates are allowed.

  • It is mutable in nature and slicing and indexing also possible.

  • It is non primitive data type.

  • List is represented using [ ].

When to use a List.

  • Speed does not matters.

  • Insertion order to be preserved.

  • Duplicate objects.

  • Crud operations allowed  |Create,Read,Update,Delete

Ways to create a List

  • Blank List

  1.            ls = [ ]              #Blank List

  2.            ls = list( )         #Blank List


Post a Comment

Post a Comment (0)