COMPUTER PROGRAMMING FUNDAMENTALS
WHAT IS PROGRAMMING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
(1, 2, ‘three’, 4)
|
|
[1, 2, ‘three’, 4]
|
|
{1, 2, ‘three’, 4}
|
|
(1, 2, 3, 4)
|
Detailed explanation-1: -In Python, lists are represented by square brackets.
Detailed explanation-2: -Lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with different qualities and usage.
Detailed explanation-3: -Explanation: Elements of lists are stored in contagious memory location is the true regarding lists in Python.
Detailed explanation-4: -The correct answer to the question “Which of the following is a Python Tuple” is option (B). (1, 2, 3). Because in Python, Tuple is represented in round brackets. So, all the other options are incorrect.
Detailed explanation-5: -Python Lists Important thing about a list is that the items in a list need not be of the same type. list1 = [’physics’, ‘chemistry’, 1997, 2000]; list2 = [1, 2, 3, 4, 5 ]; list3 = ["a", “b", “c", “d"]; Similar to string indices, list indices start at 0, and lists can be sliced, concatenated and so on.