Chapter 4 Flashcards
Programs are composed of what?
Modules.
Modules contain _____________?
Statements
Statements contain ______________?
Expressions
Expressions _______ and __________ objects
Create, and process
What are literals?
The expressions that generate objects
Everything that is processed in python is an ________?
Object.
Strings are used to store __________ __________ as well as __________ _________ of ________.
Textual information, arbitrary collection ,bytes
items in sequences are located and fetched using by their ______________?
relative position
Strictly speaking strings are sequences of _________ __________.
one character strings
if S = “Spam”, how would I return the length of hte string?
len(S).
len() is a built in functin in python.
With the string S=”Spam” what would the expression S[0} return?
“S”
Define what an index of a sequence is .
is a numbering system to identify the position of a charater in a sequence. always starts with 0.
Python variable never need to be _______ ahead of time?
declared.
Indexing is based on a ___________?
zero based position.
a variable is created when i _______ a _________ to it.
assign, value
positive indexes count from the ________. while negative indexes count from the _________.
front, back.
Slices are a way to extract an entire _________ from a string in a single step.
column
the form for slices X[ I :J] means what ?
give me everything from X from the offset I up to but not including offset J.
if S=”Spam” what does S[:3] return?
‘Spa’
if S=”Spam” . What does S[:] return?
‘Spam’