Informatics Practices
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.
Python List Manipulation
2 Likes
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
In Python, an index is a number specifying the position of an element in a list. Indexing in a list can be positive and negative. Positive indexing starts from 0 for the first element, while negative indexing starts from -1 for the last element. Indexing is defined using square brackets ([]).
Answered By
2 Likes
Related Questions
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): 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.
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.