Computer Science
Assertion (A): Tuple in Python is an ordered and immutable data type.
Reasoning (R): Tuples can contain heterogenous data and permit duplicate values as well.
- 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 Tuples
2 Likes
Answer
Both A and R are true but R is not the correct explanation of A.
Explanation
Tuples in Python are ordered, meaning elements are arranged in a specific sequence, and this order cannot be changed. Tuples are immutable, so once a tuple is created, we cannot add, change, or update its elements. Duplicate values can be included in a tuple. Additionally, a tuple can hold values of different data types, making it heterogeneous in nature.
Answered By
2 Likes
Related Questions
What will be the output?
D1 = { "Rahul":56, "Virat":99} print("virat" in D1)
- True
- False
- No output
- Error
Which of the following creates a tuple?
- t1 = ("a", "b")
- t1 [2]= ("a", "b")
- t1= (5) *2
- None of these
Consider the given two statements:
Statement 1: t1 = tuple('python')
Statement 2: t1[4] = 'z'Assertion (A): The above code will generate an error.
Reasoning (R): Tuple is immutable by nature.
- 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, tuple is an immutable sequence of data.
Reasoning (R): Immutable 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.