Post

Python Programming
Python Programming@PythonPr·
Python Question / Quiz; What is the output of the following Python code, and why? Comment your answers below!
Python Programming tweet media
English
34
7
115
11K
Sergei Kotov
Sergei Kotov@kotov_dev·
@PythonPr Answer: B) <class 'list'> [1, 2, 3] is a list, so type() returns <class 'list'> For beginners: › [1, 2, 3] = list (square brackets) › (1, 2, 3) = tuple (parentheses) › {1, 2, 3} = set (curly braces) › {1: 'a'} = dict (key: value pairs)
English
2
1
22
1.1K
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@PythonPr Answer: B — <class 'list'> Square brackets [] create a list in Python. Tuples use (), sets use {}, and dicts use {key: value}.
English
0
0
7
621
IrisTech
IrisTech@IrisTechss·
@PythonPr I haven't gotten to this topic yet. Hope to answer correctly subsequent questions.
English
0
0
2
45
ANKIT 𓃱
ANKIT 𓃱@A9kitSingh·
@PythonPr Answer is B) <class 'list'> Square brackets [] create a list in Python, so type([1, 2, 3]) is list.
English
0
0
2
163
Sixtus Agbakwuru
Sixtus Agbakwuru@SixtusAgbakwuru·
@PythonPr B ✅. The data is a list. It is one of the data types in python, and one of the four collections in python.
English
0
0
1
539
Jay
Jay@learnaiwthme·
@PythonPr B. Brackets mean list in Python.
English
0
0
1
403
Ehshanulla
Ehshanulla@Ehshanulla·
@PythonPr [1, 2, 3] is a list in Python type() returns the data type of the object Python displays list types as <class 'list'>
English
0
0
1
50
laso
laso@lasitolas·
@PythonPr B...list always known by square brackets. Tuple is distinguished by round brackets(). Think of that as lock dataset
English
0
0
1
11
Gizzy Codes
Gizzy Codes@GafarIb42311292·
@PythonPr The correct option is B List uses square brackets [] Tuple uses normal bracket i.e parenthesis () Set uses curly brackets {} Dictionary also uses curly brackets, but it's different from set because it has keys, and values. E.g my_dict = {'color' : 'blue'}
English
0
0
0
40
Siddartha DevOps
Siddartha DevOps@SiddarthaDevops·
@PythonPr <class 'list'> written in square brackets as always creates list. type() tells data type of object.
English
0
0
0
1
Paylaş