You have already used objects. A string is an object with methods:
name = "maya"
loud_name = name.upper()Line-by-line explanation
- The first line creates a string object.
name.upperselects its upper method.- The method call creates
MAYA. - That new string is stored.
Tiny Practice
Call the lower method on the string.
Starter template
word = "HELLO"
small = CHANGE_MELine-by-line explanation
- Word is a string object.
- Strings have a lower method.
Hint
- Start with
word. - Use a dot.
- Call
lower().
Show Solution
word = "HELLO"
small = word.lower()Line-by-line explanation
- Word stores the object.
- Lower creates a lowercase string.
- Small stores
hello.