Lesson 4: print() function in python | formatting using print function in python | output formatting

Publicado em: 18 Agosto 2024
no canal de: VCODE LOGIC
10
0

The print() function in Python is one of the most commonly used functions,
and its primary purpose is to output data to the console


Formatting the Output:

name="vcode logic"
age=100

1.Concatenation:

print("Name: " + name + ", Age: " + str(age))

2. f-Strings (Python 3.6+):

print(f"Name: {name}, Age: {age}")
{} is place holder
A placeholder can fcontain variables, operations, functions, and modifiers to format the value.

3.Controlling the End of Output:
print("Hello", end=" ")
print("World!")

Printing Special Characters
You can use escape characters to include special characters in your output:

\n: Newline
\t: Tab
\\: Backslash
\": Double quote
\': Single quote


Nesta página do site você pode assistir ao vídeo on-line Lesson 4: print() function in python | formatting using print function in python | output formatting duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário VCODE LOGIC 18 Agosto 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 10 vezes e gostou 0 espectadores. Boa visualização!