1.3.1 Using print()
The print() function is used to display output in Python.
It is commonly used to show results, debug programs, and communicate information to users.
Basic Output
The simplest use of print() is to display text or values.
print() can output:
- Text strings
- Numbers
- Variable values
- Expressions
Multiple values can be printed in a single call, separated by commas.
Output Formatting Basics
By default:
- Values are separated by spaces
- Output ends with a newline
These default behaviors make print() suitable for most basic output needs.
Common Use Cases
- Displaying calculation results
- Showing program status messages
- Debugging variables during development
📌 Note:
print()is one of the most frequently used functions when learning and debugging Python.