Definition
Standard built-in functions for interacting with the user via text input and output.
Why It Matters
They are the fundamental eyes and mouth of a program, allowing digital logic to interact with the physical world. Without them, code would be a black box with no way to receive instructions or report its findings.
Core Concepts
print(): Outputs values to the console.input(): Pauses execution to gather user keyboard input; always returns a string.len(): Returns the integer count of characters in a string (or items in a collection).- Function Invocation: The syntax
name()calls the function, whilename(without parentheses) refers to the function object itself.
print("What is your name?")
user_name = input()
print(f"Hello, {user_name}!")
print(f"Your name is {len(user_name)} characters long.")