-2
elif Antwort == "yes":
    print("""Es ist schade, dass es Dir so geht wie mir.
    Willst Du also auswandern?""")

Es ist schade, dass es Dir so geht wie mir.
    Willst Du also auswandern?

I use the """ to be able to split the string over two lines but the code displayed does not start from the same starting point.

Maybe I need to use "\n" and string summing (advice from my friend)? But I really don't know how to write the next code...

yuki
  • 5
  • 2
  • It's really not clear what you expect. I believe `print` in this situation will in fact print *exactly* the string you gave it, so it's not correct to say it's not preserving the original format. – tripleee Sep 09 '21 at 04:24
  • If the duplicate is not the answer to what you _tried_ to ask, please [edit] to clarify what you are trying to accomplish. – tripleee Sep 09 '21 at 04:36

1 Answers1

1

Yes, the string includes literally everything you type, including the leading spaces. You have a couple of choices. You can shift the text to the left margin:

elif Antwort == "yes":
    print("""Es ist schade, dass es Dir so geht wie mir.
Willst Du also auswandern?""")

or you can use regular strings, concatenated:

elif Antwort == "yes":
    print("Es ist schade, dass es Dir so geht wie mir.\n"
    "Willst Du also auswandern?")
Tim Roberts
  • 48,973
  • 4
  • 21
  • 30