w3resource
Python Exercises

Python: Print a list of space-separated elements

Python List: Exercise - 62 with Solution

Write a Python program to print a list of space-separated elements.

Python: Print a list of space-separated elements

Sample Solution:-

Python Code:

num = [1, 2, 3, 4, 5]
print(*num)

Sample Output:

1 2 3 4 5

Flowchart:

Flowchart: Print a list of space-separated elements

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 create a list of empty dictionaries.
Next: Write a Python program to insert a given string at the beginning of all items in a list.

What is the difficulty level of this exercise?