voidex/20-29 Areas/20 Programming/20.01 Python/print().md

697 B

title tags aliases
print()
python
functions
output
print
print-statement
output-text

[!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}!")