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

Veröffentlicht am: 18 August 2024
auf dem Kanal: 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


Auf dieser Seite können Sie das Online-Video Lesson 4: print() function in python | formatting using print function in python | output formatting mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer VCODE LOGIC 18 August 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 10 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!