Computer Science
Assertion. Lists and Tuples are similar sequence types of Python, yet they are two different data types.
Reason. List sequences are mutable and Tuple sequences are immutable.
Python List Manipulation
2 Likes
Answer
(a)
Both Assertion and Reason are true and Reason is the correct explanation of Assertion.
Explanation
Lists and tuples are similar sequence types in python, but they are distinct data types. Both are used to store collections of items, but they have different properties and use cases. Lists are mutable, meaning you can add, remove, or modify elements after the list is created. Tuples, on the other hand, are immutable, meaning once a tuple is created, its contents cannot be changed.
Answered By
1 Like
Related Questions
For any index n, s[:n] + s[n:] will give you original string s.
A dictionary can contain keys of any valid Python types.
Assertion. Modifying a string creates another string internally but modifying a list does not create a new list.
Reason. Strings store characters while lists can store any type of data.
Assertion. Modifying a string creates another string internally but modifying a list does not create a new list.
Reason. Strings are immutable types while lists are mutable types of python.