0% found this document useful (0 votes)
3 views1 page

Python Functions Methods Cheatsheet

This document is a cheat sheet for Python functions and methods, providing examples for built-in functions, list methods, dictionary methods, string methods, and set methods. It includes concise descriptions and usage examples for each function and method. The cheat sheet serves as a quick reference for Python programming.

Uploaded by

sujenkumar92
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)
3 views1 page

Python Functions Methods Cheatsheet

This document is a cheat sheet for Python functions and methods, providing examples for built-in functions, list methods, dictionary methods, string methods, and set methods. It includes concise descriptions and usage examples for each function and method. The cheat sheet serves as a quick reference for Python programming.

Uploaded by

sujenkumar92
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

Python Functions & Methods – Cheat Sheet with

Examples

Built-in Functions
• len(x) → length of object | Example: len([1,2,3])
• type(x) → data type | Example: type(10)
• sum(iterable) | Example: sum([1,2,3])
• min(), max() | Example: max([4,7,1])
• range(start, stop, step) | Example: range(1,5)
• sorted(iterable) | Example: sorted([3,1,2])

List Methods
• append(x) | Example: [Link](5)
• insert(i, x) | Example: [Link](1, 10)
• extend(iterable) | Example: [Link]([3,4])
• remove(x) | Example: [Link](2)
• pop() | Example: [Link]()
• sort() | Example: [Link]()

Dictionary Methods
• keys() | Example: [Link]()
• values() | Example: [Link]()
• items() | Example: [Link]()
• get(key) | Example: [Link]('a')
• update(dict) | Example: [Link]({'b':2})

String Methods
• upper() | Example: [Link]()
• lower() | Example: [Link]()
• split() | Example: [Link]()
• replace(a,b) | Example: [Link]('a','b')
• startswith() | Example: [Link]('py')

Set Methods
• add(x) | Example: [Link](3)
• remove(x) | Example: [Link](2)
• union() | Example: [Link](s2)
• intersection() | Example: [Link](s2)

You might also like