0% found this document useful (0 votes)
6 views5 pages

My Notes

The document provides a comprehensive list of built-in functions in Python, detailing their purposes and usage. It also categorizes functions into four types: built-in functions, user-defined functions, lambda functions, and generator functions. Additionally, it outlines various commonly used Python statements, including conditional, looping, jump, function, import, class, and try-except statements.

Uploaded by

vibha.search
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

My Notes

The document provides a comprehensive list of built-in functions in Python, detailing their purposes and usage. It also categorizes functions into four types: built-in functions, user-defined functions, lambda functions, and generator functions. Additionally, it outlines various commonly used Python statements, including conditional, looping, jump, function, import, class, and try-except statements.

Uploaded by

vibha.search
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Here is a list of built-in functions in Python:

 abs(): Returns the absolute value of a number.


 all(): Returns True if all values in an iterable are true.
 any(): Returns True if any value in an iterable is true.
 bin(): Converts an integer to a binary string.
 bool(): Converts a value to a Boolean value.
 bytearray(): Returns an array of bytes.
 bytes(): Returns a bytes object.
 callable(): Returns True if an object is callable.
 chr(): Returns a character from an integer.
 classmethod(): Creates a class method.
 compile(): Compiles a Python code string into a code object.
 complex(): Creates a complex number.
 delattr(): Deletes an attribute from an object.
 dict(): Creates a dictionary.
 dir(): Returns a list of the specified object's properties and methods.
 divmod(): Returns a tuple containing the quotient and remainder of two numbers.
 enumerate(): Returns an enumerate object.
 eval(): Evaluates a Python expression.
 exec(): Executes a Python code object.
 filter(): Returns an iterator that filters elements from an iterable.
 float(): Converts a value to a floating-point number.
 format(): Formats a value according to a format specification.
 frozenset(): Returns a frozenset object.
 getattr(): Returns the value of an attribute (property or method).
 globals(): Returns the global symbol table.
 hasattr(): Returns True if an object has an attribute.
 hash(): Returns the hash value of an object.
 help(): Displays help information for an object.
 hex(): Converts an integer to a hexadecimal string.
 id(): Returns the identity of an object.
 input(): Reads a line from the standard input.
 int(): Converts a value to an integer.
 isinstance(): Returns True if an object is an instance of a specified class.
 issubclass(): Returns True if a class is a subclass of a specified class.
 iter(): Returns an iterator object.
 len(): Returns the length of an object.
 list(): Creates a list.
 locals(): Returns the local symbol table.
 map(): Returns an iterator that applies a function to each element of an iterable.
 max(): Returns the maximum value in an iterable.
 memoryview(): Returns a memory view object.
 min(): Returns the minimum value in an iterable.
 next(): Returns the next element from an iterator.
 object(): Creates a new object.
 oct(): Converts an integer to an octal string.
 open(): Opens a file.
 ord(): Returns the integer value of a character.
 pow(): Returns the value of x to the power of y.
 print(): Prints one or more values to the standard output.
 property(): Creates a property object.
 range(): Returns an immutable sequence of numbers.
 repr(): Returns a string representation of an object.
 reversed(): Returns a reversed iterator.
 round(): Rounds a number to a specified number of decimal places.
 set(): Creates a set.
 setattr(): Sets the value of an attribute (property or method).
 slice(): Creates a slice object.
 sorted(): Returns a sorted list.
 staticmethod(): Creates a static method.
 str(): Converts a value to a string.
 sum(): Returns the sum of the elements of an iterable.
 super(): Returns a proxy object that allows you to call methods of a parent class.
 tuple(): Creates a tuple.
 type(): Returns the type of an object.
 vars(): Returns the __dict__ attribute of an object.
 zip(): Returns an iterator that aggregates elements from two or more iterables.

There are four types of functions in Python:


1. 1. Built-in functions:
These functions are defined in the Python language itself and are available to all Python
programs. Some examples of built-in functions are print(), len(), and type().

2. 2. User-defined functions:
These functions are defined by the user and can be used in any Python program. To define a
user-defined function, you use the def keyword followed by the function name, parameters,
and a colon. The body of the function is indented and ends with a return statement.

3. 3. Lambda functions:
These are anonymous functions that can be defined on the fly. Lambda functions are typically
used for short, one-off functions. To define a lambda function, you use the lambda keyword
followed by the parameters and the expression to be evaluated.
4. 4. Generator functions:
These functions generate a sequence of values one at a time. Generator functions are typically
used for iterating over large datasets or for creating infinite sequences. To define a generator
function, you use the def keyword followed by the function name, parameters, and a
colon. The body of the generator function contains a yield statement.

some of the most commonly used Python statements in a PDF


format.
1. Conditional statements:
These statements allow you to control the flow of your program by
executing certain blocks of code based on certain conditions.
 if statement:
This statement allows you to execute a block of code if a certain condition is met.
 if-else statement:
This statement allows you to execute one block of code if a certain condition is met, and
another block of code if the condition is not met.
 elif statement:
This statement allows you to execute multiple blocks of code based on different conditions.
 else statement:
This statement allows you to execute a block of code if none of the other conditions in an if-elif-
else statement are met.
 Looping statements:
These statements allow you to execute a block of code repeatedly until a
certain condition is met.
 while loop: This statement allows you to execute a block of code repeatedly while a
certain condition is met.
 for loop: This statement allows you to execute a block of code a certain number of
times, or for each item in a list.
 Jump statements:
These statements allow you to alter the normal flow of your program by
jumping to a different part of the code.
 break statement: This statement allows you to exit a loop early.
 continue statement: This statement allows you to skip the rest of the current iteration
of a loop and start the next iteration.
 Function statements:
These statements allow you to define your own functions, which are blocks
of code that can be reused throughout your program.
 def statement: This statement allows you to define a new function.
 Import statements:
These statements allow you to import modules, which are collections of
code that can be used in your program.
 import statement: This statement allows you to import a module.
 from statement: This statement allows you to import specific functions or variables
from a module.
 Class statements:
These statements allow you to define your own classes, which are
blueprints for creating objects.
 class statement: This statement allows you to define a new class.
 Try-except statements:
These statements allow you to handle errors that may occur in your
program.
 try statement: This statement allows you to try a block of code and handle any errors
that may occur.
 except statement: This statement allows you to handle a specific type of error.
 finally statement: This statement allows you to execute a block of code regardless of
whether an error occurred.
These are just a few of the most commonly used Python statements. There
are many other statements that you can use, but these are a good starting
point.

You might also like