How Do You Create a Multiline Variable Assignment in Python?

Problem scenario
You want a multi-line variable in Python without triple single or triple double quotes. How do you create it?

Solution
Use "\n" with quotes.

This program illustrates how:

var_1 = "This is just a test"
var_2 = "a line below"
compose = var_1 + "\n" + var_2
print(compose)

Leave a comment

Your email address will not be published. Required fields are marked *