Ch. 5 Flashcards
strings, lists, files
accessing a single character out of a string is called
indexing
which of the following is same as [0:-1]
s[:len(s)-1 ]
what function gives the unicode value of a character?
ord
which of the following can not be used to convert a string of digits into a number
eval
a successor to ASCII that includes characters from (nearly) all written languages is
unicode
Which string method converts all the characters of a string to upper case?
upper
The string “slots” that are filled in by the format method are marked by:
{}
which of the following is not a file-reading method in python
readall
the term for a program that does its input and output with files is
batch
Before reading or writing to a file, a file object must be created via:
open
s1 = “spam”
s2 = “ni!”
“The Knights who say, “ + s2
the knights who say ni!
s1 = “spam”
s2 = “ni!”
3 * s1 + 2 * s2
spamspamspamni!ni!
s1 = “spam”
s2 = “ni!”
s1[1]
p
s1 = “spam”
s2 = “ni!”
s1[1:3]
pa
s1 = “spam”
s2 = “ni!”
s1[2] + s2[:2]
ani