Python Exercise: Create a tuple with different data types
Python tuple: Exercise-2 with Solution
Write a Python program to create a tuple with different data types.
Sample Solution:
Python Code:
# Create a tuple containing elements of different data types
tuplex = ("tuple", False, 3.2, 1)
# Print the contents of the 'tuplex' tuple
print(tuplex)
Sample Output:
('tuple', False, 3.2, 1)
Flowchart:
Python Code Editor:
Previous: Write a Python program to create a tuple.
Next: Write a Python program to create a tuple with numbers and print one item.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://198.211.115.131/python-exercises/tuple/python-tuple-exercise-2.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics