CISC 101 Chapter Notes - Chapter 8: String Literal, Word Processor, Substring

32 views9 pages

Document Summary

Iterating over a string with a for loop: one of the easiest ways to access the individual characters in a string is to use the for loop. Indexing: another way you can access the individual characters in a string is with an index, each character in a string has an index that specifies its position in the string. Indexerror exceptions: an indexerror exception will occur if you try to use an index that is out of range for a particular string. If you leave out the start index in a slicing expression, python uses 0 as the starting index: the second statement assigns the string patty" to first_name. If you leave out the end index in a slicing expression, python uses the length of the string as the end index: slicing expressions can also have step value, which causes characters to be skipped in the string.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents