Informatics Practices
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.
Python List Manipulation
2 Likes
Answer
A is true but R is false.
Explanation
In Python, list is an mutable data type, i.e., values in the list can be modified. In-place changes are possible in list elements. We can modify, add, or remove elements in a list directly.
Answered By
2 Likes
Related Questions
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): 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.
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.
What are the various ways of creating a list?