What are the list data type tuple data type set data type

List data type:

I f we want to represent a group of values as a single entity where insertion order required topreserve and duplicate objects are allowed then we should go for list data type.

  • Insertion order is preserved
  • Heterogeneous objects are allowed
  • Duplicates are allowed
  • Growable in nature
  • Values should be enclosed within square brackets.

 

Tuple data type :

Tuple data type is exactly same as list data type except that it is immutable. i.e we can not change values.

Tuples can be represented within parenthesis.

Set data type :

I f we want to represent a group of values without duplicates where order is not important then we should go for  set data type.

  • Insertion order is  not preserved
  • Heterogeneous objects are allowed
  • Duplicates are not  allowed
  • Index concept is not applicable
  • It is mutable collection
  • Growable in nature