Computer Science
How is an empty tuple created ?
Python Tuples
7 Likes
Answer
There are two ways of creating an empty tuple:
- By giving no elements in parentheses in assignment statement.
Example:
emptyTuple = () - By using the tuple function.
Example:
emptyTuple = tuple()
Answered By
3 Likes
Related Questions
Are the following two assignments same ? Why / why not ?
T1 = 3, 4, 5 T2 = ( 3, 4 , 5)
2.
T3 = (3, 4, 5) T4 = (( 3, 4, 5))
What would following statements print? Given that we have tuple= ('t', 'p', 'l')
- print("tuple")
- print(tuple("tuple"))
- print(tuple)
How is a tuple containing just one element created ?
How can you add an extra element to a tuple ?