Assignments or Comparisons?

Here's one last thing to talk about before we move on - and this doesn't just apply to variables, but to strings and numbers as well.

When we create a variable and give it a value, we use a single equals sign = to assign that value.

>>> fruit = "watermelon"

>>> five = 6

But remember earlier when we were working with numbers and we used the double equals sign == to do comparisons?

>>> fruit == "watermelon"

True

>>> 5 == 6

False

One equal sign or two? How can you remember which one to use?

Here's an easy way to remember the difference, using something called a mnemonic:

When we're assigning a value, we're saying "this equals that". That's a short sentence, so it only gets one equal sign: =

But when we're comparing values, we're asking "is this thing equal to that thing?". And that's a longer sentence, so it gets two equal signs: ==