Let it be

Saturday, January 20, 2024

 

Python Collections (Arrays)


List:  list =["mango", "strawberry", "orange","apple", "banana"]
 

Array a = arr.array('i', [1, 2, 3])

tuple = ("orange","apple","banana")

set : thisset = {"apple", "orange", "banana"}

dictionary : thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964  }


Python Collections (Arrays)

There are four collection data types in the Python programming language:

  • List is a collection which is ordered and changeable. Allows duplicate members.
  • Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
  • Set is a collection which is unordered, unchangeable*, and unindexed. No duplicate members.
  • Dictionary is a collection which is ordered** and changeable. No duplicate members.


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home