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
Watch video Lesson 4: print() function in python | formatting using print function in python | output formatting online without registration, duration hours minute second in high quality. This video was added by user VCODE LOGIC 18 August 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 8 once and liked it 0 people.