# Indices in Strings ![rw-book-cover](https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png) URL:: https://brilliant.org/practice/slicing/?p=2 Author:: brilliant.org ## Highlights > If you read our quiz on functions, you'll know that they take in arguments inside their parenthesis and output a value. > As of now, `find` is for all intents and purposes a function, except that it uses a different syntax. Instead of writing `find(str1, str2)` or something similar, the command is written `str1.find(str2)`. > There are technical reasons behind this, which we'll dive into in later chapters. But there is also a practical reason: in the notation `find(str1, str2)`, one can easily forget in which order the strings have to be written. The proper syntax `str1.find(str2)` reads more like a sentence: > "Inside `str1`, find `str2`." > We call commands like these, that use the dot notation, **methods**. They are essentially functions that are only defined in the context of some variable (more precisely, an *object*) in the program. ([View Highlight](https://read.readwise.io/read/01gfpj2s3b1jekdnfwandv0ma6)) --- Title: Indices in Strings Author: brilliant.org Tags: readwise, articles date: 2024-01-30 --- # Indices in Strings ![rw-book-cover](https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png) URL:: https://brilliant.org/practice/slicing/?p=2 Author:: brilliant.org ## AI-Generated Summary There are technical reasons behind this, which we'll dive into in later chapters. ## Highlights > If you read our quiz on functions, you'll know that they take in arguments inside their parenthesis and output a value. > As of now, `find` is for all intents and purposes a function, except that it uses a different syntax. Instead of writing `find(str1, str2)` or something similar, the command is written `str1.find(str2)`. > There are technical reasons behind this, which we'll dive into in later chapters. But there is also a practical reason: in the notation `find(str1, str2)`, one can easily forget in which order the strings have to be written. The proper syntax `str1.find(str2)` reads more like a sentence: > "Inside `str1`, find `str2`." > We call commands like these, that use the dot notation, **methods**. They are essentially functions that are only defined in the context of some variable (more precisely, an *object*) in the program. ([View Highlight](https://read.readwise.io/read/01gfpj2s3b1jekdnfwandv0ma6))