Computer Science
What will be the output of the following Python code ?
tp = ()
tp1 = tp * 2
print(len(tp1))
- 0
- 2
- 1
- Error
Python Tuples
2 Likes
Answer
0
Reason — Empty tuples multiplied with any number yield empty tuples only.
Answered By
2 Likes
Related Questions
What will be the output of following Python code?
tp1 = (15,11,17,16,12) tp1.pop(12) print(tp1)
- (15,11,16,12)
- (15,11,17,16)
- (15,11,17,16,12)
- Error
Which of the following options will not result in an error when performed on types in Python where tp = (5,2,7,0,3) ?
- tp[1] = 2
- tp.append(2)
- tp1=tp+tp
- tp.sum()
What will be the output of the following Python code?
tp = (5) tp1 = tp * 2 print(len(tp1))
- 0
- 2
- 1
- Error
What will be the output of the following Python code?
tp = (5,) tp1 = tp * 2 print(len(tp1))
- 0
- 2
- 1
- Error