0% found this document useful (0 votes)
9 views3 pages

Techstack Cheat Sheet

The document provides a comprehensive list of Python methods and functions categorized into strings, numbers, lists, tuples, dictionaries, sets, and common built-in functions. Each method and function is briefly described with its purpose. This serves as a reference guide for Python programming.

Uploaded by

archanassingh24
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)
9 views3 pages

Techstack Cheat Sheet

The document provides a comprehensive list of Python methods and functions categorized into strings, numbers, lists, tuples, dictionaries, sets, and common built-in functions. Each method and function is briefly described with its purpose. This serves as a reference guide for Python programming.

Uploaded by

archanassingh24
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/ 3

23/07/2025, 22:41 Untitled108

In [ ]: #1. String (str) Methods


.capitalize() # First letter capital
.casefold() # Lowercase all
.center(width) # Center string
.count(sub) # Count substring
.encode() # Encode string
.endswith(suffix) # Check suffix
.find(sub) # Find substring index
.format() # Format string
.index(sub) # Like find, but raises error
.isalnum() # Alphanumeric
.isalpha() # Only letters
.isdigit() # Only digits
.islower() # All lowercase
.isupper() # All uppercase
.isspace() # Only spaces
.istitle() # Title format
.join(iterable) # Join with separator
.lower() # Lowercase
.upper() # Uppercase
.lstrip() # Left strip
.rstrip() # Right strip
.strip() # Both side strip
.replace(old, new) # Replace substring
.rfind() # Reverse find
.split() # Split by delimiter
.rsplit() # Split from right
.startswith(prefix)# Check prefix
.swapcase() # Toggle case
.title() # Title case
.zfill(width) # Fill with zeros

#2. Number (int, float, complex) Functions


abs(x) # Absolute value
bin(x) # Binary
oct(x) # Octal
hex(x) # Hexadecimal
pow(x, y) # x ** y
round(x[, n]) # Round to n digits
int(x) # Convert to integer
float(x) # Convert to float
complex(x, y) # Create complex
divmod(a, b) # Return (a//b, a%b)

#3. List (list) Methods


.append(x) # Add to end
.extend(iterable) # Add multiple
.insert(i, x) # Insert at index
.remove(x) # Remove by value
.pop([i]) # Remove by index
.clear() # Remove all
.index(x) # Index of value
.count(x) # Count occurrences
.reverse() # Reverse list
.sort() # Sort list
.copy() # Shallow copy

#4. Tuple (tuple) Methods

file:///Users/manojsingh/Downloads/Untitled108.html 1/3
23/07/2025, 22:41 Untitled108

.count(x) # Count occurrences


.index(x) # Index of item

#5. Dictionary (dict) Methods


.clear() # Remove all items
.copy() # Shallow copy
.fromkeys(seq) # Create dict with keys
.get(key) # Get value
.items() # Return key-value pairs
.keys() # Return keys
.values() # Return values
.pop(key) # Remove key
.popitem() # Remove last item
.setdefault(k, v) # Default value if not present
.update(dict2) # Merge dictionaries

#6. Set (set) Methods


.add(x) # Add element
.update(iterable) # Add multiple
.remove(x) # Remove (error if not found)
.discard(x) # Remove (no error)
.pop() # Remove random element
.clear() # Empty set
.copy() # Shallow copy
.union(set2) # Combine sets
.intersection(set2)# Common items
.difference(set2) # Unique to set1
.symmetric_difference(set2) # Items not in both
.issubset(set2) # Subset check
.issuperset(set2) # Superset check
.isdisjoint(set2) # No common elements

#7. Common Python Built-in Functions (All Types)


type(x) # Get the type of variable x
id(x) # Get the memory address of x
len(x) # Return number of items in an object
sorted(iterable) # Return a sorted list from iterable
enumerate(iterable) # Return index and value as pairs
range(start, stop) # Generate a sequence of numbers
zip(a, b) # Combine two iterables into tuples
map(func, iterable) # Apply function to each item
filter(func, iterable) # Filter items using function
sum(iterable) # Return sum of items
max(iterable) # Return largest item
min(iterable) # Return smallest item
any(iterable) # Return True if any element is True
all(iterable) # Return True if all elements are True
reversed(iterable) # Reverse the iterable
list() # Convert to list
tuple() # Convert to tuple
dict() # Convert to dictionary
set() # Convert to set
str() # Convert to string
int() # Convert to integer
float() # Convert to float
bool() # Convert to boolean
input() # Get input from user
print() # Print output
eval() # Evaluate Python expression from string
exec() # Execute Python code from string

file:///Users/manojsingh/Downloads/Untitled108.html 2/3
23/07/2025, 22:41 Untitled108

chr(x) # Convert integer to Unicode character


ord(c) # Convert character to Unicode integer
help(obj) # Show help documentation
dir(obj) # List attributes and methods
isinstance(obj, type) # Check if object is instance of type
issubclass(sub, super) # Check if class is subclass of another

file:///Users/manojsingh/Downloads/Untitled108.html 3/3

You might also like