CS 1301 Chapter Notes - Chapter 8: Substring, Short Circuit, Empty String

38 views3 pages

Document Summary

Compound data types- types that comprise smaller pieces; made of components, or elements that are themselves values. Upper- method that can be invoked on any string object to create a new string where all characters are in uppercase: lower, capitalize, swapcase. 8. 3 working with the parts of a string. Indexing operator- python uses square brackets to enclose index; selects single character substring from a string. Len- returns number of characters in string: ex. len ( happy ) 5. Negative indices- count backward from end of string: ex. fruit[-1] gives last letter; fruit[-2] gives second to last letter. Traversal- pattern of processing; to iterate through elements of a collection, performing a similar operation on each. Slice- able to obtain substring through this method; slice a list to refer to some sublist of items in the list; part of a string (substring) specified by range of indices. Use (= =) in order to draw comparisons between two strings.

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