Full Comparison of Methods for List, String, Tuple,
and Dictionary
Method List String Tuple Dictionary Input Type Description
append() ✔ - - - value Adds element at the end of list
extend() ✔ - - - iterable Appends elements from another iterable
insert() ✔ - - - index, value Inserts element at given index
remove() ✔ - - - value Removes first occurrence of element
pop() ✔ - - ✔ index (optional for list), key(for dict) Removes element at index (list) or key (dict)
clear() ✔ - - ✔ none Removes all elements
index() ✔ ✔ ✔ - value Returns index of first occurrence
count() ✔ ✔ ✔ - value Counts number of occurrences
sort() ✔ - - - none or key function Sorts list in ascending order
reverse() ✔ - - - none Reverses list in place
copy() ✔ - - ✔ none Returns shallow copy
capitalize() - ✔ - - none Capitalizes first character
casefold() - ✔ - - none Converts string to lowercase (more aggressive than lower)
center() - ✔ - - width, fillchar(optional) Centers string with padding
encode() - ✔ - - encoding(optional) Returns encoded string
format() - ✔ - - values Formats string
isalpha() - ✔ - - none Checks if all chars are alphabetic
isdigit() - ✔ - - none Checks if all chars are digits
isalnum() - ✔ - - none Checks if all chars are alphanumeric
islower() - ✔ - - none Checks if all chars are lowercase
isupper() - ✔ - - none Checks if all chars are uppercase
isspace() - ✔ - - none Checks if all chars are whitespace
istitle() - ✔ - - none Checks if string is titlecased
split() - ✔ - - separator(optional) Splits string into list
rsplit() - ✔ - - separator(optional) Splits string from the right
strip() - ✔ - - chars(optional) Removes leading/trailing characters
lstrip() - ✔ - - chars(optional) Removes leading characters
rstrip() - ✔ - - chars(optional) Removes trailing characters
replace() - ✔ - - old, new Replaces substring with another
upper() - ✔ - - none Converts to uppercase
lower() - ✔ - - none Converts to lowercase
startswith() - ✔ - - prefix Checks if string starts with prefix
endswith() - ✔ - - suffix Checks if string ends with suffix
Method List String Tuple Dictionary Input Type Description
find() - ✔ - - substring Returns lowest index of substring
rfind() - ✔ - - substring Returns highest index of substring
partition() - ✔ - - separator Splits into 3 parts: before, separator, after
rpartition() - ✔ - - separator Splits into 3 parts from the right
swapcase() - ✔ - - none Swaps case of all characters
title() - ✔ - - none Converts string to title case
zfill() - ✔ - - width Fills string with zeros at the beginning
count() - - ✔ - value Counts number of occurrences
index() - - ✔ - value Returns index of first occurrence
get() - - - ✔ key Returns value for key, or None
keys() - - - ✔ none Returns all keys
values() - - - ✔ none Returns all values
items() - - - ✔ none Returns key-value pairs
update() - - - ✔ dict or iterable Updates dictionary with given pairs
fromkeys() - - - ✔ keys, value(optional) Creates new dict with given keys
setdefault() - - - ✔ key, default(optional) Returns value if key exists, else inserts default
popitem() - - - ✔ none Removes and returns last inserted key-value pair