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
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
join() - ✔ - - iterable of strings Concatenates iterable with separator
split() - ✔ - - separator(optional) Splits string into list
strip() - ✔ - - chars(optional) Removes leading/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
find() - ✔ - - substring Returns lowest index of substring
rfind() - ✔ - - substring Returns highest index of substring