Join the conversation

| Feature | List | Tuple | Set | Dictionary |
| ---------- | ----------- | ----------- | --------------- | --------------------- |
| Ordered | Yes | Yes | No (mostly) | Yes |
| Mutable | Yes | No | Yes | Yes |
| Duplicates | Allowed | Allowed | Not Allowed | Keys: No, Values: Yes |
| Indexing | Yes | Yes | No | Keys access only |
| Syntax | `[1, 2, 3]` | `(1, 2, 3)` | `{1, 2, 3}` | `{'a': 1}` |
Reply

| Feature | List | Tuple | Set | Dict |
| ----------------------------- | ---- | ----- | --- | ---- |
| Stores multiple items | ✅ | ✅ | ✅ | ✅ |
| Can be looped | ✅ | ✅ | ✅ | ✅ |
| Can store mixed types | ✅ | ✅ | ✅ | ✅ |
| Allows membership test (`in`) | ✅ | ✅ | ✅ | ✅ |
Reply

wonderful
Reply

Learning
Reply

List:Mutable: Aap ismein changes kar sakte hain.Ordered: Aitebaar ke saath tarteeb di gayi.Duplicates Allowed: Doosri martaba istemal ho sakta hai.Indexed Access: Index ka istemal karke items ko access kar sakte hain.Tuple:Immutable: Ek martaba ban gayi tou tabsiraat nahi kar sakte.Ordered: Tarteeb di gayi hai.Duplicates Allowed: Doosri martaba istemal ho sakta hai.Indexed Access: Index ka istemal karke items ko access kar sakte hain.Set:Mutable: Aap ismein changes kar sakte hain.Unordered: Koi tarteeb nahi hai.No Duplicates: Sirf unique items hote hain.Unindexed Access: Index ka istemal nahi kar sakte.Dictionary:Mutable: Aap ismein tabsiraat (changes) kar sakte hain.Unordered (Python 3.6 aur pehle) / Ordered (Python 3.7+): Python 3.7 se onwards order preserve hota hai.No Duplicate Keys: Har key unique hai, magar values duplicate ho sakti hain.Key-Value Access: Keys ka istemal karke items ko access kar sakte hain.
Reply

sir very easy explain
Reply

Ur teaching method is osm sir
Reply

# Data structures# List (mutable , ordered , Accept duplicate , Access by index)list = ["orange" , "apple" , "banana" , "banana"]
print(list)
print(list[2])list[2] = "papita"
print(list)
print(list[2])# Tuples (immutable , ordered , Accept duplicate , Access by index)
tuple = (1 , 2 , 3 , 4 , 5 , 6 , 2)
print(tuple)
print(tuple[6])# Sets (Muteable , unordered , no duplicate , not access by index)set = {1 , 3 , 5 ,7}
print(set)
set.add(13)
print(set)# Dictionaries(Muteable , ordered , just allow values duplicate not key , accessed by key)dict = {"babar" : 56 ,
"Shaheen" : 10 ,
"Nawaz" : 10 ,
}dict["Nawaz"] = 68
print(dict)
Reply

list are ordered and set is unordered, list has index and set has not, set remove duplicate automatically and list accept duplicates
Reply

it is good
Reply