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

Essential Python Methods & Functions Guide

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)
5 views1 page

Essential Python Methods & Functions Guide

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 Beginner's Starter Pack - Essential Methods & Functions

1. String Methods (str)


- .lower() → lowercase
- .upper() → uppercase
- .title() → capitalize first letter of each word
- .strip() → remove spaces from ends
- .replace(old, new) → replace text
- .split() → split into list
- .join(list) → join list into string
- .find(sub) → find index of substring
- .count(sub) → count occurrences
- .startswith(prefix) → check start
- .endswith(suffix) → check end

2. List Methods (list)


- .append(item) → add to end
- .insert(index, item) → insert at position
- .remove(item) → remove first match
- .pop(index) → remove & return
- .sort() → sort list
- .reverse() → reverse order
- .count(item) → count occurrences
- .index(item) → find index
- .extend(list2) → merge lists
- len(list) → length

3. Number Functions
- abs(x) → absolute value
- round(x, n) → round to n decimals
- max(a, b, c) → largest
- min(a, b, c) → smallest
- sum(list) → sum of numbers

4. General Built-ins
- len(x) → number of items
- type(x) → check type
- str(x) → convert to string
- int(x) → convert to int
- float(x) → convert to float

You might also like