697 B
697 B
title | tags | aliases | ||||||
---|---|---|---|---|---|---|---|---|
print() |
|
|
[!note] Concept The
print()
function outputs a message (usually a string) to the screen.[!example] Example
print('Hello, world!') print('What is your name?') # ask for name print() # Blank Output
[!important] Best Practices
- Use
print()
to confirm variable values or trace execution during debugging.- Add comments to describe the purpose of each printed message where helpful. For formatted strings, prefer:
name = "Alice" print(f"Hello, {name}!")