Python Basic String Operator Flashcards

 

card 1 of 10

 

'a'

 

quotes are used for character strings

'a'

card 2 of 10

 

"a"

 

single or doublequotes (pairs must match) can be used

'a'

card 3 of 10

 

"ab c"

 

'ab c'

card 4 of 10

 

''

 

strings can be empty

''

card 5 of 10

 

"ab"+"cd"

 

+ operator concatenates strings

'abcd'

card 6 of 10

 

'a'+"a"+'a'

 

mixing quote styles is permitted

'aaa'

card 7 of 10

 

'a'*3

 

* is like repeated +

'aaa'

card 8 of 10

 

3*'a

 

remember to match pairs of quotes

SyntaxError - while scanning single-quoted string

card 9 of 10

 

3*'a'

 

3*'a' and 'a'*3 have same result

'aaa'

card 10 of 10

 

'bb'/2

 

it's true that 'b'*2 evaluates to 'bb', but ...

TypeError - the '/' operator isn't supported for strings

 

End of Problem Set

(use browser reload to restart this problem set)