Chapter 17 - Concept Summary

Chapter 17 included the following concepts from computing.

Summary of Python Keywords and Functions

  • Find - The source.find(target) function returns the position of the target string in the source string if it is there or -1 if it is not.

  • Split - The split function returns a list of strings separated by a specified character. For example, if message = "Nora, Jones, 15" then message.split(",") would return ['Nora', 'Jones', '15'].

  • Slice - The statement source[pos] returns the character at that position in the string. This uses an index to get the character from the string at that index. The statement source[start:end] returns the characters from start to one before end. It uses two indices the start index (inclusive) and the end index (exclusive) to return a substring of the string from the start character to one before the end character.

Note

This is the end of chapter 17. We would love it if you could give us some feedback on this chapter at https://www.surveymonkey.com/r/ch17-teacher-fb. You might want to open this link in a new tab to make it easier for you to return to your place in this ebook.

You have attempted of activities on this page