First page Back Continue Last page Overview Graphics

Fundamentals on Strings

Function

Example

Concatenation

>>> language = "Python"

>>> language + " is great!"

'Python is great!'

Repetition

>>> "." * 7

'.......'

>>> 7 * "."

'.......'

Indexing

>>> language[0]

'P'

>>> language[-1]

'n'

Slicing

>>> language[1:3]

'yt'

Length

>>> len(language)

6