Just put the line break character where you want the break.
This character is typed by escaping the letter "n" with a backslash - the famous sequence " n" - when the Python parser finds this sequence inside a string it is automatically converted to the line break character used in Unix systems, which is universal ("print" then converts to the correct sequence on each operating system):
print("Olá,", Nome,
"\n A sua fatura com vencimento em ", DiaVencimento, " de ", MêsVencimento, "no valor de R$", ValorFatura, "está fechada.")
It’s also not cool to keep opening and closing quotes, plus commas all the time - Python has several possibilities of string formatting that allow you to create your output text in a much more readable way. One of them is the string ". format" method:
print("Olá {nome}\n. A sua fatura com vencimento em {vencimento} de {mesvencimento} no valor de R${valor:0.02f} está fechada".format(nome=nome, vencimento=DiaVencimento, mesvencimento=MesVencimento, valor=float(ValorFatura)))
And in version 3.6 onwards you can even use strings with the prefix f" "
which allow direct formatting from variables, without needing to call the method format
. I mean, it just stays that way:
print(f"Olá, {Nome}\n A sua fatura com vencimento em {DiaVencimento} de {MêsVencimento} no valor de R$ {ValorFatura} está fechada.")
Python allows variables with accented names
MêsVencimento
? I swore that this was not allowed.– Woss
In Python 3 can yes - I personally would not recommend, but can.
– jsbueno