In Python, square brackets [] are used for lists, while curly braces {} are used for dictionaries.
A list is a collection of items that are ordered and changeable. You can access items from a list by their index, and you can add or remove items from a list. Here is an example of a list in Python:
my_list = ['apple', 'banana', 'orange']
A dictionary is a collection of items that are unordered and changeable. Each item in a dictionary consists of a key and a value, and you can access items from a dictionary by their keys. Here is an example of a dictionary in Python:
my_dict = {
'name': 'John Doe',
'age': 32,
'city': 'New York'
}
Both lists and dictionaries are data types that are commonly used in Python, but they are used for different purposes. Lists are used to store a collection of items that are ordered and accessible by their index, while dictionaries are used to store a collection of items that are unordered and accessible by their keys.
Peer-to-Peer Review/Critique
What qualifies as a critique on Boardspeck
To send a review or critique to this Author on this article, Please LOGIN or SIGN UP
Author
Most Read Boardspeck Posts
-
EMMANUEL OJEX
@emmanuelojex -
MASTER PIECE
@Master_piece -
OFFICIAL BOARDSPEC...
@boardspeck -
MCKODEV TECH LAB
@mckodev -
KABIRU SHUAIBU
@kabiru_2761
-
OFFICIAL BOARDSPEC...
@boardspeck -
EMMANUEL OJEX
@emmanuelojex -
AKOLE BANJI
@banjella -
THE TUNDE OLUWATUY...
@toec2020 -
DA SILVA
@Gbenga_Olubummo