Browse

Python String & List Methods

Learn what common Python string and list methods do and recall them by name.

Code34 items3 levelsDifficulty 2/5
Start training →

Free · no signup · works on any device

Levels

Start easy — harder levels unlock as you improve, or jump ahead anytime.

1
Common String Methods
12 items
2
Common List Methods
11 items
3
Advanced Methods
11 items

All 34 cards

str.upper()
converts to uppercase
str.lower()
converts to lowercase
str.strip()
removes leading and trailing whitespace
str.split()
splits string into a list
str.join()
joins items into a string
str.replace()
replaces a substring
str.find()
returns index of substring, -1 if absent
str.startswith()
checks if it starts with a prefix
str.endswith()
checks if it ends with a suffix
str.capitalize()
capitalizes the first character
str.title()
capitalizes each word
str.count()
counts occurrences of a substring
list.append()
adds an item to the end
list.extend()
adds all items from an iterable
list.insert()
inserts an item at an index
list.remove()
removes first matching value
list.pop()
removes and returns item at index
list.index()
returns index of a value
list.count()
counts occurrences of a value
list.sort()
sorts the list in place
list.reverse()
reverses the list in place
list.copy()
returns a shallow copy
list.clear()
removes all items
str.isdigit()
checks if all characters are digits
str.isalpha()
checks if all characters are letters
str.swapcase()
swaps the case of each letter
str.zfill()
pads on the left with zeros
str.rstrip()
removes trailing whitespace
str.lstrip()
removes leading whitespace
str.splitlines()
splits at line breaks
str.partition()
splits into three parts at first separator
str.index()
returns index of substring, error if absent
str.isspace()
checks if all characters are whitespace
list.sort(reverse=True)
sorts the list in descending order

Keep going

Python Built-in Functions

Learn what Python's most common built-in functions do.

Code38 items

Big-O Time Complexity of Common Operations & Algorithms

Test your knowledge of the time complexity of common data structure operations and classic algorithms.

Code35 items

Common Network Ports and Their Services

Learn which service runs on each well-known TCP/UDP port number.

Code40 items

Data Structures: Use & Time Complexity

Test your knowledge of common data structures, their typical uses, and the Big-O time complexity of their core operations.

Code34 items