Find function in Python 3.x
<p>When we have the following: </p>

<pre><code>tweet2 = 'Want cheap snacks? Visit @cssu office in BA2283'
</code></pre>

<p><code>print(tweet2[tweet2.find('cheap')])</code> results in the output <code>'c'</code> and I cant wrap my head around how it does this. I tried the visualizer and it didn't show anything. Could anyone please explain?</p>

<p><code>tweet2.find('cheap')</code> returns the index at which the beginning of "cheap" is found, and when that index is used in <code>tweet2[index]</code>, it returns the character at that index, which is "c"</p>

python python-3.x