COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Creating a list
|
|
Initializing variables using values from a list
|
|
Storing multiple variables’ values by putting them in a collection, like a list or tuple
|
|
Cramming as many commands as possible onto a single line
|
Detailed explanation-1: -Packing is a technique in python with which we put several values into a single iterator. If we talk of packing in literal terms, Just like we pack certain items into a box in the real world, In python we pack certain variables in a single iterable.
Detailed explanation-2: -Tuple packing refers to assigning multiple values into a tuple. Tuple unpacking refers to assigning a tuple into multiple variables.
Detailed explanation-3: -You can assign multiple values to multiple variables by separating variables and values with commas, . You can assign to more than three variables. It is also possible to assign to different types. If there is one variable on the left side, it is assigned as a tuple.
Detailed explanation-4: -Tuples are used to store multiple items in a single variable. Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage. A tuple is a collection which is ordered and unchangeable.