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
On this page of the site you can watch the video online Lesson 4: print() function in python | formatting using print function in python | output formatting with a duration of hours minute second in good quality, which was uploaded by the user VCODE LOGIC 18 August 2024, share the link with friends and acquaintances, this video has already been watched 10 times on youtube and it was liked by 0 viewers. Enjoy your viewing!