w3resource

Python: Use double quotes to display strings

Python Basic: Exercise-130 with Solution

Write a Python program to use double quotes to display strings.

Pictorial Presentation:

Use double quotes to display strings

Sample Solution:-

Python Code:

import json
print(json.dumps({'Alex': 1, 'Suresh': 2, 'Agnessa': 3}))

Sample Output:

{"Agnessa": 3, "Alex": 1, "Suresh": 2}

Flowchart:

Flowchart:Use double quotes to display strings.

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

 

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to add leading zeroes to a string.
Next: Write a Python program to split a variable length string into variables.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz



Python: Tips of the Day

Unpack variables from iterable:

# One can unpack all iterables (tuples, list etc)
>>> a, b, c = 1, 2, 3
>>> a, b, c
(1, 2, 3)

>>> a, b, c = [1, 2, 3]
>>> a, b, c
(1, 2, 3)