Informatics Practices
Assertion (A): In Python, list is an immutable collection of data.
Reasoning (R): Mutable means that any change or alteration in data is mentioned in the same place. The updated collection will use the same address for its storage.
- 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
A is false but R is true.
Explanation
In Python, list is a mutable collection of data, i.e., values in the list can be modified. The term "mutable" means that the objects can be changed in place, and any modifications to the object will use the same memory address.
Answered By
2 Likes
Related Questions
Consider the given two statements:
T1 = [3, 9, 0, 1, 7]
T2 = [5, 1, 0, 7, 5.5]Assertion (A): Output of
print(len(T1) == len(T2))is True.Reasoning (R): The
len()function returns the number of elements in the list. If two lists have same number of elements, then==operator will return 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 traversal in Python is done through slicing and using for loop also.
Reasoning (R): Traversal can be done only through forward indexing.
- 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): 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.