Python Question
Elizabeth_Mason (5)

My computer science teacher wants me to put this phrase in one line of code. But I have no idea what to do. I have tried every possible way I could think of. Can anyone help me?

You are viewing a single comment. View All
Answered by theangryepicbanana (1005) [earned 5 cycles]
View Answer
theangryepicbanana (1005)

try using \n and \t in the string

theangryepicbanana (1005)

@Elizabeth_Mason if I did print("A lightning flash:\nbetween the forest trees"), I'd get the following output:

A lightning flash:
between the trees

Knowing that, are you able to figure out the rest?

Elizabeth_Mason (5)

@theangryepicbanana none of them will work. This is what I get every time...

theangryepicbanana (1005)

@Elizabeth_Mason you don't need to add extra strings; the \n inserts a "new line" and the \t inserts a tab

Elizabeth_Mason (5)

@theangryepicbanana Yea thank you...If I need anymore help I will contact you. Thank you!

theangryepicbanana (1005)

@Elizabeth_Mason No problem! (also mark my comment as "best answer" is it helped)

Elizabeth_Mason (5)

@theangryepicbanana Hey I have tried with the \n and \t ... I don't know what else to do.


theangryepicbanana (1005)

@Elizabeth_Mason you don't need any spaces after the \n

Elizabeth_Mason (5)

I will ask my teacher through email...or I will ask her tomorrow

theangryepicbanana (1005)

@Elizabeth_Mason ok, maybe she mistyped something for the assignment

Elizabeth_Mason (5)

@theangryepicbanana Maybe...Thanks again for your help!!! :):):)

Muhammad_SJC (4)

@theangryepicbanana you know you can save all the hassle by typping the message inside 3 speech marks:

print("""A lightning flash:
            between the forest trees
            I have seen water.
                                 -Shiku""")