Informatics Practices
Assertion (A): An empty list can be created using list() method.
Reasoning (R): The following snippet—
>>>L1 = list()
>>>print(L1)
will give the output as:
[]
This statement holds true.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python List Manipulation
1 Like
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
An empty list can be created using list() method. The provided code:
>>>L1 = list()
>>>print(L1)
will give the output as: [], which represents an empty list.
Answered By
3 Likes
Related Questions
Assertion (A): The position of each element in the list is considered as its index.
Reasoning (R): Indexing in a list can be positive and negative; index is defined using [] brackets.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): sort() method sorts the objects of list in ascending order.
Reasoning (R): Defining sort() method with reverse=True as an argument sorts the list elements in descending order.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): List is mutable data type.
Reasoning (R): In-place change is not possible in list elements.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): List slices are the sub-part of a list extracted out.
Reasoning (R): In Python, Slice operator[:] is used to select a range of elements from a sequence.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.