How To Print Vertically In Python

In this tutorial, we will learn how to print vertically in Python. This can be a useful skill when you have a piece of text that needs to be displayed in a vertical format for readability and aesthetical purposes.

Step 1: Getting Input

First, we need to get the input string from the user. We will use the input() function to get a string from the user.

Step 2: Print Vertically

Now that we have the input string, we can print it vertically by iterating through each character and printing it on a new line. This can be done using a simple for loop as shown below:

By using the print() function with the default value of the end parameter, we ensure that each character will be printed on a new line.

Step 3: Combining the Steps

Now, let’s combine steps 1 and 2 in a single Python script.

You can now run the script, enter a piece of text, and see it printed vertically.

Output

Enter the text to print vertically: Hello, World!
H
e
l
l
o
,

W
o
r
l
d
!

Full Code

Conclusion

In this tutorial, we have seen how to print vertically in Python. You can easily use this technique to improve the readability of your Python output or create various text-based designs.