From what I understand, you want if the output is displayed in multiple lines. As it stands, it results in the error:
Indexerror: tuple index out of range
For the simple fact that his string expects 4 values to be formatted correctly and you pass only 3. Therefore, such error would be supplied by passing the fourth parameter to format
, whatever.
The problem of line break is apparently because you tried to do the line break with n\
, while the line break character is \n
. But using the string between three quotes, as you are doing, there will be no need to use such a character. The line break itself in the string will cause you to break the line at the exit.
Take an example:
a = input("Digite algo: ")
saida = """
Você digitou: {}
O texto possui {} caracteres
O texto é um valor numérico? {}
"""
print(saida.format(a, len(a), a.isnumeric()))
See working on Ideone | Repl.it
Output examples:
>>> Digite algo: Anderson Carlos Woss
Você digitou: Anderson Carlos Woss
O texto possui 20 caracteres
O texto é um valor numérico? False
>>> Digite algo: 2017
Você digitou: 2017
O texto possui 4 caracteres
O texto é um valor numérico? True
Oi Matheus! Regarding your answer/new doubt. If it is related to the reply of @Andersoncarloswoss comments there in his reply. Otherwise you can create a new question.
– Sergio
If I for example mention the author of the answer and then mention a doubt I would be breaking the rule on the creation of topics?
– matheus br
If you have a question anyone can answer. If you want you can put a comment here in Anderson’s answer to indicate the link of the other question.
– Sergio
ok thank you very much. by patience.
– matheus br