0% found this document useful (0 votes)
2 views2 pages

Python Builtin Functions CheatSheet

Python Builtin Functions CheatSheet

Uploaded by

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

Python Builtin Functions CheatSheet

Python Builtin Functions CheatSheet

Uploaded by

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

Python Built-in Functions Cheat Sheet

Input/Output

print() Prints output to the screen

input() Takes input from the user

Type Conversion

int() Converts to integer

float() Converts to float

str() Converts to string

bool() Converts to boolean (True/False)

Information/Inspection

type() Returns the data type

len() Length of a sequence

id() Memory address of an object

isinstance() Checks if a variable is of a specific type

dir() Lists attributes and methods of object

help() Shows documentation for a function

Mathematical Functions

abs() Absolute value

pow(a, b) a raised to power b

round() Rounds a number

min() Smallest value

max() Largest value

sum() Sum of all items in iterable

Loops & Iterables

range() Creates a range of numbers

enumerate() Index + value while looping

zip() Combines multiple iterables


Python Built-in Functions Cheat Sheet

reversed() Reverses an iterable

Data Structures

list() Creates a list

tuple() Creates a tuple

dict() Creates a dictionary

set() Creates a set

Others

eval() Evaluates a string as code (risky)

sorted() Returns a sorted list

any() True if any item is True

all() True if all items are True

map() Applies function to each item

filter() Filters items with a condition

You might also like