| Function and inputs |
Action |
Additional Notes |
Returnage |
Functions
|
| len(string or list) |
Tells you how many items are in the list or how many characters are in the string |
|
This returns a string |
| min(list or string) |
Tells you the smallest item in the list or the "smallest" letter in a string. |
Note: letter ordering is determined by their ascii codes. Note note: Capital letters are considered first before lowercase
letters |
This returns an item from your list, or a character from your string |
| max(list or string) |
Same as min, except for the maximum item |
String Methods
|
| count(string, beginning index, end index) |
counts how many times the passed in string occurs |
if you want to begin your search at a certain point then use beginning index.
if you want to begin and end your search at certain points, then use both beginning index and end index |
This function returns a number |
| replace(thing to look for, what to replace it with, times to replace it) |
This will replace all occurences of the first string you pass in with the second string you pass in |
If you want to make at most n replacements, then you can pass in a number as an optional 3rd parameter |
This function returns a new string but makes no modification to the original string. |
List Methods
|
| append(anything) |
Adds whatever you pass in to the end of the list |
|
This function does not return anything. It will make changes to the original list |
| pop() |
Removes the last item from the list |
Don't pop an empty list. Your computer will explode. |
This function returns the item it removed |
| sort() |
This will sort a list of comparable items. Such as strings or numbers. |
|
This function does not return anything. It will make changes to the original list |
| reverse() |
This will reverse the order of a list. |
|
This function does not reutrn anything. It will make changes to the original list |