Strings

Slicing, useful methods and f-strings.

A string is a sequence of characters, counted from 0. A negative index counts from the end.

Expected output
I
p
Inter
10

Methods

Strings cannot be changed in place, so methods return a new string.

Expected output
Erode, Tamil Nadu
ERODE, TAMIL NADU
['erode', 'tamil nadu']
salem, tamil nadu

f-strings

Put f before the quotes to place values straight into the text.

Expected output
Divya scored 87.5%
โ† Variables and data typesConditions โ†’