Boston Python Workshop 6/Friday/Tutorial: Difference between revisions

Content added Content deleted
imported>Jesstess
imported>Jesstess
Line 459: Line 459:
</pre>
</pre>


Use <code>==</code> to test for equality. Recall that <code>=</code> is used for <i>assignment</i> (e.g. <code>my_string == "Hello"</code>).
Use <code>==</code> to test for equality. Recall that <code>=</code> is used for <i>assignment</i>.


This is an important idea and can be a source of bugs until you get used to it: <b>= is assignment, == is comparison</b>.
This is an important idea and can be a source of bugs until you get used to it: <b>= is assignment, == is comparison</b>.