Python Exercise: Create a tuple with different data types
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.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics