Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Python Built in Functions Notes

Uploaded by

celineava.009
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)
4 views

Python Built in Functions Notes

Uploaded by

celineava.009
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

Important Python Built-in Functions

Basic Functions

print() - display output

input() - get user input

len() - get the length of an object

type() - check the type of a variable

id() - get the memory address of an object

Conversion Functions

int(), float(), str(), bool() - convert between types

list(), tuple(), set(), dict() - convert or create containers

ord() - char to Unicode code

chr() - Unicode code to char

Math and Numbers

abs() - absolute value

round() - round a number

pow() - power (same as **)

sum() - sum items in an iterable

min(), max() - smallest/largest in iterable

divmod() - get quotient and remainder

Working with Iterables

range() - generate a range of numbers

enumerate() - get index + value in loop

zip() - combine multiple iterables

map() - apply function to items

filter() - filter items by a condition

reversed() - reverse an iterable

sorted() - sort items

any() - True if any item is True


Important Python Built-in Functions

all() - True if all items are True

next() - get next item from iterator

iter() - get iterator from iterable

Other Useful Functions

open() - open a file

help() - get help on object or function

dir() - list attributes of an object

eval() - evaluate a string as Python code

exec() - execute a string as Python code

isinstance() - check type

callable() - check if object is callable

globals(), locals() - current variable scope

You might also like