← All references
print()
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)Print objects to the console.
print()
The print() function outputs the given objects to the standard output (console by default).
Parameters
- objects — one or more values to print, separated by
sep. - sep — string inserted between values (default:
" "). - end — string appended after the last value (default:
"\n").
Common Uses
- Debugging with
print(x) - Formatted output with f-strings:
print(f"Hi {name}") - Multiple values:
print(a, b, c)
Example
# print() examples
print("Hello, World!")
print("Name:", "Aarav", "Age:", 21)
print("a", "b", "c", sep="-")
print("No newline", end=" ")
print("continues")
name = "Priya"
print(f"Hi {name}!")