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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

+ and * operator

A

work with string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

index operator

A

school = “Luther College”
m = school[2]
print m

last_char = school[-1]
print last_char

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly