Chapter 5 Lists and Dictionaries: The Hangman Game - FariaJaheen/Python-Programming GitHub Wiki

Table 5.1 Selected List Methods

  1. append(value) : Adds value to the end of a list.
  2. sort() : Sorts the elements, smallest value first. Optionally, you can pass a Boolean value to the parameter reverse. If you pass True, the list will be shorted with the largest value first.
  3. reverse() : Reverses the order of a list.
  4. count(value) : Returns the number of occurrences of the value.
  5. index(value) : Returns the first position number of where value occurs.
  6. insert(i, value) : Inserts value at position i.
  7. pop([i]) : Returns value at position i and removes value from the list. Providing the position number i is optional. Without it, the last element in the list is removed and returned.
  8. remove(value) : Removes the first occurrences of value from the list.

Table 5.2 Selected Dictionary Methods

  1. get(key, [default]) : Returns the value of key. If key doesn't exist, then the optional default is returned. key doesn't exist, then the optional default isn't specified then None is returned.
  2. keys() : Returns a view of all the keys in a dictionary.
  3. values() : Returns a view of all the values in a dictionary.
  4. items() : Returns a view of all the items in a dictionary.