print() vs len()
print() and len() are both Python Built-in Functions APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. print(): Prints objects to the text stream, separated by `sep` and followed by `end`. Its syntax is print(*objects, sep=" ", end="\n", file=sys.stdout, flush=False), and it returns none len(): Returns the length (number of items) of an object. Works with sequences, collections, and strings. Its syntax is len(s), and it returns integer length Example of print(): print("Hello", "World", sep=", ") # Hello, World. Example of len(): len([1, 2, 3]) # 3
len("hello") # 5. Read the full references for print() and len() to see parameters, edge cases, and example code side by side. Other Built-in Functions APIs worth comparing: range(), type(), int(), float(), str(), bool().