Computer Science
What is the difference between "book" and ('book',)?
Python Tuples
2 Likes
Answer
The difference between "book" and ('book',) is that "book" is a string, representing a sequence of characters, while ('book',) is a tuple with a single element.
Answered By
2 Likes
Related Questions
Write the code to create an empty tuple.
Write a Python program to create a tuple with different data types and display.
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)
Find errors and rewrite the same after correcting the following code:
d1 = {1:10, 2.5:20, 3:30, 4:40, 5:50, 6:60, 7:70}