Computer Science
Choose the correct statement(s).
- Both tuples and lists are immutable.
- Tuples are immutable while lists are mutable.
- Both tuples and lists are mutable.
- Tuples are mutable while lists are immutable.
Python Tuples
2 Likes
Answer
Tuples are immutable while lists are mutable.
Reason — Tuples can not be modified where as List can be modified.
Answered By
2 Likes
Related Questions
Can you have an integer, a string, a tuple of integers and a tuple of strings in a tuple?
Which of the following statements will create a tuple:
- tp1=("a", "b")
- tp1[2]=("a", "b")
- tp1=(3)*3
- None of these
Choose the correct statement(s).
- In Python, a tuple can contain only integers as its elements.
- In Python, a tuple can contain only strings as its elements.
- In Python, a tuple can contain elements of different types.
- In Python, a tuple can contain either string or integer but not both at a time
Which of the following is/are correctly declared tuple(s) ?
- a = ("Hina", "Mina", "Tina", "Nina")
- a = "Hina", "Mina", "Tina", "Nina")
- a = ["Hina", "Mina", "Tina", "Nina"]
- a = (["Hina", "Mina", "Tina", "Nina"])