0% found this document useful (0 votes)
6 views

Python Key Functions

Python includes 68 built-in functions that facilitate data handling, computations, and program flow management. The functions are categorized into various groups such as basic functions, numeric and mathematical functions, sequence and iterable functions, and more. Each function is briefly explained, highlighting its purpose and usage.

Uploaded by

whaynezyrus983
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python Key Functions

Python includes 68 built-in functions that facilitate data handling, computations, and program flow management. The functions are categorized into various groups such as basic functions, numeric and mathematical functions, sequence and iterable functions, and more. Each function is briefly explained, highlighting its purpose and usage.

Uploaded by

whaynezyrus983
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Complete List of Python Built-in Functions: A Comprehensive Guide

Python provides 68 built-in functions that offer various capabilities for handling data,
performing computations, and managing program flow. Below is a categorized list with brief
explanations for each function.

1. Basic Functions

 print(*objects, sep=' ', end='\n') – Displays output.

 input(prompt) – Takes user input as a string.

 type(object) – Returns the data type of an object.

 id(object) – Returns the memory address of an object.

 len(iterable) – Returns the number of elements in an iterable.

 repr(object) – Returns a string representation of an object.

 isinstance(object, classinfo) – Checks if an object is an instance of a class.

 issubclass(sub, sup) – Checks if a class is a subclass of another.

 hash(object) – Returns a hash value for an object.

 dir(object) – Lists valid attributes of an object.

2. Numeric & Mathematical Functions

 abs(x) – Returns absolute value of a number.

 pow(x, y, mod=None) – Computes x to the power of y.

 round(x, n=0) – Rounds a number to n decimal places.

 sum(iterable, start=0) – Returns the sum of an iterable.

 max(iterable, *args, key=None) – Returns the largest element.

 min(iterable, *args, key=None) – Returns the smallest element.

 divmod(a, b) – Returns quotient and remainder as a tuple.

 bin(x) – Converts an integer to binary.

 oct(x) – Converts an integer to octal.


 hex(x) – Converts an integer to hexadecimal.

3. Sequence & Iterable Functions

 list(iterable) – Creates a list from an iterable.

 tuple(iterable) – Creates a tuple from an iterable.

 range(start, stop, step=1) – Generates a sequence of numbers.

 sorted(iterable, key=None, reverse=False) – Returns a sorted list.

 enumerate(iterable, start=0) – Returns an iterator with indexes.

 zip(*iterables) – Aggregates elements from multiple iterables.

 map(function, iterable) – Applies a function to each element.

 filter(function, iterable) – Filters elements based on a function.

4. String Functions

 str(object) – Converts an object to a string.

 chr(i) – Returns a character from a Unicode integer.

 ord(c) – Returns the Unicode integer of a character.

 ascii(object) – Returns a printable representation of an object.

 format(value, format_spec) – Formats a value.

 bytes(source, encoding) – Creates a bytes object.

 bytearray(source, encoding) – Creates a mutable bytearray object.

 memoryview(obj) – Creates a memory view of an object.

5. Dictionary & Set Functions

 dict(**kwargs) – Creates a dictionary.

 set(iterable) – Creates a set.

 frozenset(iterable) – Creates an immutable set.


6. Boolean & Comparison Functions

 bool(x) – Converts a value to True or False.

 all(iterable) – Returns True if all elements are true.

 any(iterable) – Returns True if any element is true.

7. Object & Type Handling

 object() – Creates a new object.

 super([type[, object or type]]) – Calls a parent class method.

 classmethod(function) – Converts a function to a class method.

 staticmethod(function) – Converts a function to a static method.

 property(fget, fset, fdel, doc) – Creates a property.

8. File & Input/Output Functions

 open(file, mode='r', encoding=None) – Opens a file.

 help(object) – Displays documentation for an object.

 compile(source, filename, mode) – Compiles source code into a code object.

 eval(expression, globals, locals) – Evaluates a Python expression.

 exec(object, globals, locals) – Executes a Python statement.

 input(prompt) – Accepts user input.

9. Functional Programming & Lambda Functions

 lambda args: expression – Creates an anonymous function.

 reduce(function, iterable) – Applies a function cumulatively (from functools).

 next(iterator, default) – Retrieves the next item from an iterator.

 iter(iterable, sentinel=None) – Creates an iterator.


10. Advanced Computational & System Functions

 globals() – Returns the global symbol table.

 locals() – Returns the local symbol table.

 vars([object]) – Returns __dict__ attribute of an object.

 callable(object) – Checks if an object is callable.

 delattr(object, name) – Deletes an attribute from an object.

 getattr(object, name, default) – Retrieves an attribute.

 setattr(object, name, value) – Sets an attribute.

 hasattr(object, name) – Checks if an object has an attribute.

 id(object) – Returns the memory location of an object.

 hash(object) – Returns a hash value.

 repr(object) – Returns a string representation.

 dir(object) – Lists attributes of an object.

This list covers all 68 built-in Python functions with their descriptions. 🚀

You might also like