Lesson 07
Working with Strings
Strings are sequences of characters. Use indexes to read characters: word[0] is the first one.
Slicing takes part of a string with start:end. The end position is not included.
Methods such as strip(), lower(), upper(), replace(), and split() return new strings or lists.
word = "Python"
print(word[0]) # P
print(word[1:4]) # yth
print(word.lower()) # python
sentence = "learn python today"
print(sentence.split())
print(sentence.replace("today", "now"))Check your understanding
What does "hello".upper() return?