Python Practice › String Programs › Program 104
Each character on a new line
Write a Python program to print each character on its own line.
Input
"python"
Output
p y t h o n
Approach
- Loop or
print(*text, sep="\n").
Solution
print(*"python", sep="\n")Output
p y t h o n
Line by line
Line 1
* unpacks the string into separate characters and sep="\n" puts each on its own line.
Learn the concept
New to this topic? Read the lesson, then come back.