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

Publicado el: 18 agosto 2024
en el 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


En esta página del sitio puede ver el video en línea Lesson 4: print() function in python | formatting using print function in python | output formatting de Duración hora minuto segunda en buena calidad , que subió el usuario VCODE LOGIC 18 agosto 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 10 veces y le gustó 0 a los espectadores. Disfruta viendo!