Concept Flow - print() function basics
Start
Call print()
Evaluate arguments
Convert to string
Send to output (screen)
End
The print() function takes inputs, converts them to text, and shows them on the screen.
Jump into concepts and practice - no test required
print("Hello, world!")
| Step | Action | Input | Output |
|---|---|---|---|
| 1 | Call print() | "Hello, world!" | Prepare to print |
| 2 | Evaluate argument | "Hello, world!" | "Hello, world!" as string |
| 3 | Send to output | "Hello, world!" | Hello, world! displayed on screen |
| 4 | End | - | - |
| Variable | Start | After print() call | Final |
|---|---|---|---|
| argument | None | None | None (print does not store) |
print() function basics: - Use print() to show text or values on screen - Arguments are converted to strings automatically - print() does not save or return values - Syntax: print(value1, value2, ...) - Each call outputs on a new line by default
print() function do in Python?print()print() function is used to show messages or values on the screen, making it easy to see output from the program.print().print() shows output [OK]print() separates items with spaces by default, so print('Hello', 'World') prints "Hello World".print('A', 'B', 'C', sep='-')sep parameter changes the separator between printed items. Here, it is set to '-'.print('Hello' end='!')print() must be separated by commas. Here, 'Hello' and end='!' are missing a comma.print('Hello', end='!') with a comma separating the string and the keyword argument.sep=',' prints numbers separated by commas: '1,2,3'.end='.' prints a period instead of moving to a new line.sep and end must be included in the same print call.