w3resource logo


Python Exercises

Python Exercise: Create a tuple with numbers, and display a member

Python tuple: Exercise-3 with Solution

Write a Python program to create a tuple with numbers and print one item.

Sample Solution :-

Python Code :

>>> #Create a tuple with numbers
>>> tuplex = 5, 10, 15, 20, 25
>>> print(tuplex)
>>> #Create a tuple of one item
>>> tuplex = 5,
>>> print(tuplex)

Output:

>>>
(5, 10, 15, 20, 25)
(5,)
>>>

Python Code Editor:

#Create a tuple with numbers
tuplex = 5, 10, 15, 20, 25
print(tuplex)
#Create a tuple of one item
tuplex = 5,
print(tuplex)

Improve this sample solution and post your code through Disqus.



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

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program