Computer Science
Which of the following statements converts a tuple into a list ?
- len(string)
- list(tuple)
- tup(list)
- dict(string)
Python List Manipulation
2 Likes
Answer
list(tuple)
Reason — In Python, the list() constructor function is used to convert iterable objects, such as tuples, into lists. The syntax list(tuple)
means that we are passing a tuple as an argument to the list() function, which then creates a new list containing the elements of the tuple.
Answered By
2 Likes
Related Questions
Which amongst the following is a mutable data type in Python ?
- int
- string
- tuple
- list
Which of the following statements are not correct?
(A) An element in a dictionary is a combination of key-value pair.
(B) A tuple is a mutable data type.
(C) We can repeat a key in a dictionary.
(D) clear() function is used to delete the dictionary.
- A, B, C
- B, C, D
- B, C, A
- A, B, C, D
The statement: bval = str1 > str2 shall return …………… as the output if two strings str1 and str2 contains "Delhi" and "New Delhi".
- True
- Delhi
- New Delhi
- False
What will be the output generated by the following snippet?
a = [5,10,15,20,25] k = 1 i = a [1] + 1 j = a [2] + 1 m = a [k + 1] print (i, j , m)
- 11 15 16
- 11 16 15
- 11 15 15
- 16 11 15