🧩Operator
A sign like +, > or and that works on values and gives a result.
Think of it like
Think of it like the plus and minus keys. Each key does one job.
Example
In price * 2 > 50, the * runs first, then > checks the answer. A price of 30 gives True.
Why it matters
Almost every line of code uses an operator. Knowing which goes first stops quiet maths bugs.
Definition
Example code
python
>>> 3 + 4 * 2
11
>>> (3 + 4) * 2
14Common mistake
Key takeaways
- 1Works on values. It takes one or two values in.
- 2Gives a result. A number, a true or a false.
- 3Has an order. Some operators run before others.