|
5 |
METHODS
Alongside their ability to store information assigned to a variable, data types also come with their own built-in operations and functionality in the form of methods, which take place at the element-level. By element-level, we are referring to individual values of a data object. A single string, for example, is one object consisting of numerous elements in the form of letters, numbers, spaces, and punctuation symbols. Meanwhile, a list storing three individual numbers holds each as one element, with three elements in total.
Each data type has its own unique methods for manipulating objects and methods will therefore vary with each data type. Let’s first look at two common methods that you might use with a list or a set. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access