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

31 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+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents