w3resource logo


Python Exercises

Python Exercise: Create a tuple

Python tuple: Exercise-1 with Solution

Write a Python program to create a tuple.

Sample Solution :-

Python Code :

>>> #Create an empty tuple 
>>> x = ()
>>> print(x)
>>> #Create an empty tuple with tuple() function built-in Python
>>> tuplex = tuple()
>>> print(tuplex)

Output:

>>>
()
()
>>>

Python Code Editor:

#Create an empty tuple
x = ()
print(x)
# Create an empty tuple with tuple() function built-in Python
tuplex = tuple()
print(tuplex)

Improve this sample solution and post your code through Disqus.



Join our Question Answer community to learn and share your programming knowledge.

Solve these problems:

Python: How to check whether a file exists using Python?

C#: Loops in c#

PHP: For each

SQL: JOIN using more than 5 tables

JavaScript: Blank Slide in Javascript Slideshow