What’s the difference between () vs [] vs {}?

() – tuple

A tuple is a sequence of items that can’t be changed (immutable).

[] – list

A list is a sequence of items that can be changed (mutable).

{} – dictionary or set

A dictionary is a list of key-value pairs, with unique keys (mutable). From Python 2.7/3.1, {} can also represent a set of unique values (mutable).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)