Ask coding questions

← Back to all posts
Python Question
Elizabeth_Mason

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?

Answered by theangryepicbanana [earned 5 cycles]
View Answer
Voters
HARLEYHELMICK
PashyonMosby
Elizabeth_Mason
Comments
hotnewtop
theangryepicbanana

try using \n and \t in the string

Elizabeth_Mason

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

theangryepicbanana

@Elizabeth_Mason can I see what you typed in?

Elizabeth_Mason

@theangryepicbanana sure give me a few minutes

Elizabeth_Mason







theangryepicbanana

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

Elizabeth_Mason

@theangryepicbanana So then how do I solve it?

theangryepicbanana

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

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

Elizabeth_Mason

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

theangryepicbanana

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

Elizabeth_Mason

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


theangryepicbanana

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

Elizabeth_Mason

@theangryepicbanana no correct answer

Elizabeth_Mason

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

theangryepicbanana

@Elizabeth_Mason ok, maybe she mistyped something for the assignment

Elizabeth_Mason

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

Muhammad_SJC

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

Muhammad_SJC

It actually works

vianneyt

koman on piton

josephchuang

print("A lightning flash: \n between the forest trees \n I have seen water . \n \t -Shiki

Elizabeth_Mason

@josephchuang I figured it out...there was no space between - Shiki...Thanks, everyone for the help