15.9. Chapter Concept Summary

This chapter included the following concepts from computing.

15.9.1. Summary of Python Keywords and Functions

  • len - The len (length) function returns the number of items in a collection (a string or a list). It is used like: len(list)

  • append - Adds an item to the end of a list: list.append(item)

  • insert - Adds an item to the specified position of a list: list.insert(0, item) adds the item at the start of the list.

  • pop - Removes an item from the specified position of a list: list.pop(1) removes the second item (index 1). When called without an index, list.pop(), it removes the last thing.

  • remove - Removes the first copy of the specified item from the list. list.remove("A") would remove the first “A” from the list.

You have attempted of activities on this page