Reference library
Python Reference Library
Look up a function or method when you need it. These pages are available independently of the course and do not count toward lesson progress.
Built-in Functions
- abs()
Learn how to use Python's abs() function to find the absolute value of integers and floats. Includes examples, syntax, return values, and common use cases.
- aiter()
Learn how to use the Python aiter() function to create asynchronous iterators from async iterables. Includes syntax, examples, and usage in async programming.
- all()
Learn how Python's all() function works. Check if all elements in a list, tuple, or iterable are true. Includes syntax, examples, use cases, and common mistakes.
- anext()
Learn how to use Python's anext() function to retrieve the next item from an asynchronous iterator. Includes syntax, examples, and error handling.
- any()
Learn how to use Python's any() function to check if any element in an iterable is True. Includes syntax, examples, use cases, and common mistakes.
- ascii()
Learn how Python's ascii() function returns a printable ASCII representation of any object. Covers usage, syntax, examples, and differences from repr().
- bin()
Learn how to use Python's bin() function to convert integers into binary strings. Includes syntax, examples, common use cases, and practice problems for beginners.
- bool()
Learn how Python's bool() function works. Understand how to convert values to True or False using examples and common use cases for beginners.
- breakpoint()
Learn how Python's breakpoint() function helps you pause and debug your code easily. Includes syntax, usage examples, tips, and common mistakes for beginners.
- bytearray()
Learn how to use Python's bytearray() function to create mutable sequences of bytes. Covers syntax, examples, use cases, and common pitfalls.
- bytes()
Learn how to use the Python bytes() function to create immutable byte sequences. Understand its syntax, parameters, return values, and practical examples.
- callable()
Learn how Python's callable() function works with examples. Check if an object like a function or class instance can be called using callable().
- chr()
Learn how Python's chr() function converts a Unicode code point (integer) into a character. See syntax, examples, common use cases, and beginner-friendly explanations.
- classmethod()
Learn how to use Python's classmethod() to define methods that work with the class rather than instances. Syntax, examples, use cases, and best practices included.
- compile()
Learn how Python's compile() function turns code into executable form. Explore syntax, examples, modes like 'exec', 'eval', 'single', and practical use cases.
- complex()
Learn how to use Python's complex() function to create complex numbers. This guide explains syntax, parameters, examples, and real-world uses for beginners.
- delattr()
Learn how to use Python's delattr() function to remove an attribute from an object. Includes syntax, examples, common use cases, and interview tips.
- dict()
Learn how to use Python's dict() function to create dictionaries. Understand its syntax, use cases, examples, and common mistakes in this beginner-friendly tutorial.
- dir()
Learn how to use Python's dir() function to list the attributes and methods of objects, modules, and classes. Includes examples and real-world use cases.
- divmod()
Learn how to use Python's divmod() function to get both quotient and remainder in a single step. Includes syntax, examples, and real-world use cases.
- enumerate()
Learn how Python's enumerate() function makes it easy to loop over items and get their index. See syntax, examples, and use cases that beginners can understand.
- eval()
Learn how to use Python's eval() function to evaluate expressions from strings. Includes syntax, examples, return values, and important security warnings.
- exec()
Learn how to use Python's exec() function to dynamically execute Python code. Understand syntax, use cases, examples, risks, and best practices.
- filter()
Learn how to use Python's filter() function to extract elements that match a condition from lists, tuples, and more. Syntax, examples, and use cases included.
- float()
Learn how to use Python's float() function to convert numbers and strings into floating point numbers. See syntax, examples, return values, and common errors.
- format()
Learn how to use Python's format() function to format strings with variables, numbers, and more. Includes syntax, examples, use cases, and tips.
- frozenset()
Learn how to use Python's frozenset() function to create immutable sets. Understand syntax, examples, use cases, and differences from set().
- getattr()
Learn how to use Python's getattr() function to access object attributes dynamically. Understand syntax, parameters, examples, and common use cases for beginners.
- globals()
Learn how Python's globals() function works to access and modify global variables. Includes examples, syntax, return value, and use cases.
- hasattr()
Learn how to use Python's hasattr() function to check if an object has a specific attribute. Includes syntax, examples, and real-world use cases.
- hash()
Learn how to use Python's hash() function to get the hash value of an object. Understand syntax, usage with sets and dictionaries, examples, and common pitfalls.
- help()
Learn how to use Python's help() function to explore documentation and get details about functions, classes, modules, and more. Great tool for beginners.
- hex()
Learn how to use Python's hex() function to convert integers into hexadecimal strings. Includes syntax, examples, and common use cases for beginners.
- id()
Learn how to use Python's id() function to get the identity (memory address) of an object. Understand its purpose with examples, syntax, and use cases.
- input()
Learn how to use Python's input() function to read user input from the keyboard. See syntax, examples, common mistakes, and beginner tips.
- int()
Learn how to use Python's int() function to convert numbers and strings into integers. Includes syntax, examples, edge cases, and best practices for beginners.
- isinstance()
Learn how to use Python's isinstance() function to check if a variable belongs to a certain type. Includes syntax, examples, use cases, and common errors.
- issubclass()
Learn how to use Python's issubclass() function to check if a class is a subclass of another. Includes syntax, examples, use cases, and common mistakes.
- iter()
Learn how Python's iter() function works. Understand how to create iterators from lists, tuples, and custom objects with examples and best practices.
- len()
Learn how to use Python's len() function to find the number of items in strings, lists, tuples, and other data types. Includes syntax, examples, and common uses.
- list()
Learn how to use the Python list() function to create or convert sequences into a list. Covers syntax, examples, common use cases, and beginner mistakes.
- locals()
Learn how Python's locals() function returns the local symbol table. Understand its syntax, use cases, and how it's used in functions and interactive mode.
- map()
Learn how to use the Python map() function to apply a function to every item in a list or iterable. Includes syntax, examples, and use cases for beginners.
- max()
Learn how to use the Python max() function to find the largest value in a list, tuple, or among multiple arguments. Includes examples, syntax, and common use cases.
- memoryview()
Learn how Python's memoryview() function helps you access and manipulate binary data without copying. Explore syntax, examples, and real-world use cases.
- min()
Learn how to use Python's min() function to find the smallest item in a list, tuple, or among multiple values. Includes syntax, examples, and beginner tips.
- next()
Learn how to use Python's next() function to get the next item from an iterator. Understand its syntax, default values, and use cases with examples.
- object()
Learn how Python's object() function works as the base for all classes. Understand its usage, syntax, examples, and how it's used in custom classes and inheritance.
- oct()
Learn how to use Python's oct() function to convert integers to their octal representation. Includes syntax, examples, outputs, and real-world use cases.
- open()
Learn how to use Python's open() function to read, write, and create files. Discover syntax, modes, examples, errors, and best practices for working with files.
- ord()
Learn how to use Python's ord() function to find the Unicode code point of a character. Includes syntax, examples, use cases, and common errors.
- pow()
Learn how to use the Python pow() function to raise a number to a power. Includes syntax, examples, optional modulus usage, and interview tips.
- print()
Learn how to use Python's print() function to display output on the screen. Explore syntax, examples, formatting tricks, and common interview uses.
- property()
Learn how to use the property() function in Python to control access to class attributes. Understand its syntax, usage, and benefits through simple examples.
- range()
Learn how to use Python's range() function to generate sequences of numbers. Covers syntax, parameters, examples, loops, and real-world use cases.
- repr()
Learn how to use Python's repr() function to get the official string representation of objects. Includes syntax, examples, use cases, and interview tips.
- reversed()
Learn how to use Python's reversed() function to iterate over sequences in reverse order. Includes syntax, examples, output, and beginner-friendly tips.
- round()
Learn how to use Python's round() function to round numbers to the nearest integer or specific decimal places. Includes syntax, examples, and tips for beginners.
- set()
Learn how to use Python's set() function to create sets from lists, strings, and other iterables. Includes syntax, examples, use cases, and common mistakes.
- setattr()
Learn how to use Python's setattr() function to set or update attributes of an object dynamically. Includes syntax, examples, use cases, and tips for beginners.
- slice()
Learn how to use Python's slice() function to extract portions of lists, strings, and other sequences. Includes syntax, examples, and beginner-friendly explanation.
- sorted()
Learn how to use Python's sorted() function to sort lists, tuples, and other iterables. Includes syntax, examples, key, reverse, and custom sorting tips.
- staticmethod()
Learn how Python's staticmethod() function works to define static methods in classes. Understand its syntax, examples, and how it's different from classmethods.
- str()
Learn how to use Python's str() function to convert numbers, objects, and more into readable strings. Includes syntax, examples, and common use cases.
- sum()
Learn how to use the Python sum() function to add numbers in a list, tuple, or any iterable. Includes syntax, examples, optional start value, and common mistakes.
- super()
Learn how Python's super() function works with inheritance. Understand how to call parent class methods using super() with examples and beginner-friendly explanation.
- tuple()
Learn how Python's tuple() function works to convert lists, strings, and iterables into immutable tuples. Includes examples, syntax, common use cases, and practice tips.
- type()
Learn how Python's type() function works to check the data type of a variable or create new types. Includes syntax, examples, and common use cases.
- vars()
Learn how Python's vars() function works. Understand how to get the __dict__ attribute of an object, with examples and beginner-friendly explanations.
- zip()
Learn how Python's zip() function works with lists, tuples, and other iterables. Includes syntax, examples, use cases, and common pitfalls for beginners.
- __import__()
Learn how to use Python's __import__() function to dynamically import modules at runtime. Includes syntax, examples, use cases, and beginner-friendly explanations.
String Methods
- str.capitalize()
Learn how to use the Python String capitalize() method to make the first character uppercase. Understand its syntax, use cases, and see practical examples with outputs.
- str.casefold()
Learn how to use Python's string casefold() method for case-insensitive string comparison. Includes examples, syntax, use cases, and common mistakes.
- str.center()
Learn how to use Python's string center() method to center-align a string using spaces or custom characters. Includes syntax, examples, and use cases.
- str.count()
Learn how to use Python's String count() method to count how many times a substring appears in a string. Includes examples, syntax, and common use cases.
- str.encode()
Learn how to use Python's string.encode() method to convert strings into bytes. See examples, encoding formats like UTF-8, error handling, and practical use cases.
- str.endswith()
Learn how to use Python's string endswith() method to check if a string ends with a specific suffix. Includes syntax, examples, and use cases for beginners.
- str.expandtabs()
Learn how Python's string expandtabs() method works. Replace tab characters with spaces using custom tab sizes. Includes examples and output for beginners.
- str.find()
Learn how to use Python's string find() method to locate the position of a substring within a string. Includes syntax, examples, and beginner tips.
- str.format()
Learn how to use Python's str.format() method to insert variables into strings. Includes syntax, examples, and best practices for beginners.
- str.format_map()
Learn how to use Python's String format_map() method to format strings using dictionaries. Includes syntax, examples, common errors, and best practices.
- str.index()
Learn how to use the Python String index() method to find the position of a substring in a string. Includes syntax, examples, and common mistakes to avoid.
- str.isalnum()
Learn how to use the Python string isalnum() method to check if a string contains only alphanumeric characters. Includes syntax, examples, and use cases.
- str.isalpha()
Learn how to use Python's String isalpha() method to check if all characters in a string are alphabetic. Includes examples, syntax, return values, and real-world use cases.
- str.isascii()
Learn how to use Python's string isascii() method to check if all characters in a string are ASCII. Includes syntax, examples, return values, and common use cases.
- str.isdecimal()
Learn how to use Python's string isdecimal() method to check if a string contains only decimal characters. Includes examples, syntax, return values, and common use cases.
- str.isdigit()
Learn how to use Python's string isdigit() method to check if a string contains only digits. Includes syntax, examples, return values, and tips.
- str.isidentifier()
Learn how to use Python's String isidentifier() method to check whether a string is a valid identifier. Includes examples, syntax, and common use cases.
- str.islower()
Learn how to use the Python String islower() method to check if all characters in a string are lowercase. Includes examples, syntax, and common use cases.
- str.isnumeric()
Learn how to use Python's String isnumeric() method to check if a string contains only numeric characters. Includes syntax, examples, and common use cases.
- str.isprintable()
Learn how to use Python's string isprintable() method to check if all characters in a string are printable. Includes syntax, examples, and beginner tips.
- str.isspace()
Learn how to use Python's String isspace() method to check if a string contains only whitespace characters. Includes syntax, examples, output, and tips.
- str.istitle()
Learn how Python's string istitle() method works. Check if a string is in title case where each word starts with an uppercase letter.
- str.isupper()
Learn how to use Python's String isupper() method to check if all characters in a string are uppercase. Includes syntax, examples, and common use cases.
- str.join()
Learn how to use the Python String join() method to combine a list of strings with a separator. Includes syntax, examples, use cases, and common mistakes.
- str.ljust()
Learn how to use Python's String ljust() method to left-align text with padding. See syntax, examples, and use cases for beginners.
- str.lower()
Learn how to use the Python String lower() method to convert text to lowercase. Includes syntax, examples, common use cases, and tips for beginners.
- str.lstrip()
Learn how to use Python's String lstrip() method to remove leading whitespaces or characters. Includes syntax, examples, and common use cases.
- str.maketrans()
Learn how to use the String maketrans() method in Python to build translation tables for replacing characters in strings. With syntax, examples, and use cases.
- str.partition()
Learn how to use the string partition() method in Python. Split a string into a 3-part tuple using a separator. Includes syntax, examples, and use cases.
- str.replace()
Learn how to use Python's string replace() method to replace parts of a string. Understand the syntax, examples, use cases, and common mistakes with this beginner-friendly guide.
- str.rfind()
Learn how to use Python's String rfind() method to find the last occurrence of a substring. Includes syntax, examples, and tips for beginners.
- str.rindex()
Learn how to use the Python string rindex() method to find the last occurrence of a substring. Includes syntax, examples, use cases, and error handling for beginners.
- str.rjust()
Learn how to use the Python string rjust() method to right-align text with padding. Includes syntax, examples, and use cases for beginners.
- str.rpartition()
Learn how Python's String rpartition() method works. Split a string into three parts using a separator, starting the search from the right. Includes examples and use cases.
- str.rsplit()
Learn how to use the Python string rsplit() method to split a string from the right. Includes syntax, examples, default behavior, and common use cases.
- str.rstrip()
Learn how to use Python's string rstrip() method to remove trailing whitespace or characters. Understand syntax, examples, and common use cases for rstrip().
- str.split()
Learn how to use Python's split() method to break strings into lists. Includes syntax, examples, and use cases for beginners.
- str.splitlines()
Learn how to use Python's String splitlines() method to split text into lines. Understand the syntax, examples, return value, and how it's useful for parsing multiline strings.
- str.startswith()
Learn how to use Python's string startswith() method to check if a string starts with a specific prefix. Includes syntax, examples, and common use cases.
- str.strip()
Learn how to use the strip() method in Python to remove leading and trailing spaces from strings. Includes syntax, examples, common uses, and beginner tips.
- str.swapcase()
Learn how to use Python's string swapcase() method to convert lowercase letters to uppercase and uppercase letters to lowercase. Includes syntax, examples, and use cases.
- str.title()
Learn how to use the Python String title() method to convert a string to title case. Includes syntax, examples, use cases, and beginner-friendly explanation.
- str.translate()
Learn how to use Python's String translate() method to replace characters using a translation table. Includes examples, syntax, and practice tips.
- str.upper()
Learn how to use Python's string upper() method to convert any string to uppercase. Includes syntax, examples, use cases, and beginner tips.
- str.zfill()
Learn how to use Python's String zfill() method to pad numeric strings with zeros on the left. Includes syntax, examples, output, and use cases.