--- title: print() tags: - python - functions - output aliases: - print - print-statement - output-text --- > [!note] Concept > The `print()` function outputs a message (usually a string) to the screen. > > > [!example] Example > > ```python > > 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: > > ```python > > name = "Alice" > > print(f"Hello, {name}!") > > ```