Python Exercise: Print a tuple with string formatting
Write a Python program to print a tuple with string formatting.
Pictorial Presentation:

Sample Solution:
Python Code:
# Create a tuple containing three numbers
t = (100, 200, 300)
# Use the 'format' method to insert the tuple 't' into the string and print the result
print('This is a tuple {0}'.format(t))
Sample Output:
This is a tuple (100, 200, 300)
Flowchart:

Python Code Editor:
Previous: Write a Python program to convert a list of tuples into a dictionary.
Next: Write a Python program to replace last value of tuples in a list.
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