Strings Flashcards
1
Q
String
A
A string is a sequence of characters.
• A string that contains no characters, often referred to as the empty string, is
still considered to be a string.
2
Q
+ and * operator
A
work with string
3
Q
index operator
A
school = “Luther College”
m = school[2]
print m
last_char = school[-1]
print last_char
4
Q
String methods
A
Like turtles, strings are objects. Each object has its own attributes and
methods. To call a method, we write object.method()
5
Q
String length
A
The len function, when applied to a string, returns the number of characters in a string. fruit = "Banana” print len(fruit)