Computer Science
Write a Python program to create a tuple with different data types and display.
Python Tuples
1 Like
Answer
t = tuple((42, "Hello, World!", 3.14, True, [1, 2, 3]))
print(t)
Output
(42, 'Hello, World!', 3.14, True, [1, 2, 3])
Answered By
1 Like
Related Questions
What is nested tuple? Explain with example.
Write the code to create an empty tuple.
What is the difference between "book" and ('book',)?
Write a Python program to combine first 3 elements and last 3 elements from a tuple.
T1 = ('a', 1, 2, 3, 4, 'b', 'c', 'book', 10)
Output should be:
('a', 1, 2, 'c', 'book', 10)