[Python] Why won't it give me a new line?

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I want the output printed onto two lines, but it won't print anything. Instead, I get an error code: <SyntaxError: unexpected character after line continuation character>

    It highlights the "n" after the escape slash, as if the "n" shouldn't be there. But how am I supposed to get this to print onto two lines? Thanks

    name = "Alice"
    age = 30
    print("Name:", name,\n"Age:", age)

    Continue reading...

Compartilhe esta Página