Similarly, I can decide that I would like the addition to happen first in the second

expression we looked at, by using parentheses to evaluate, have it evaluate

first. Up to this point, every instruction that

we gave to Python yielded a result. For example, when we asked Python to

evaluate the expression two plus three, it gave us the result five.

That's because the expression two plus, plus three follows the syntax of the

Python language. Syntax is the rules that specify which

combinations of symbols are legal, and two plus three is a valid expression in

Python. The expression three plus with a

combination of symbols, three +, is not valid syntax.

So when I ask Python to evaluate this expression, we get an error.

This is our first syntax error and we'll see many more throughout the course.

So Python does not understand what to do with those, with that combination of

symbols and it can't give us back a result, so instead it gives us an error.

Another combination symbols that will result in a syntax error would be to just

use the exponentiation operator on its own without providing any [indiscernible].

We can also write an expression like the one we just saw, only instead of having an

open, opening and closing parentheses, we just include a closing parenthesis.

That will give us a syntax error. It would include an opening parenthesis

but no closing, then we end up with a different situation.

When I hit enter, nothing happens, or it looks like nothing happens.

That's because Python allows instructions to extend multiples lines.

When we hit enter, it's waiting, actually, for the closing parenthesis.

Until I give that closing parenthesis, and hit enter, then, the expression isn't

violated. In addition to syntax errors, we'll also

encounter semantic errors. Semantic errors occur when the meaning of

a particular expression is invalid. So for example, the syntax of two plus

three is valid that is above the combination of symbols.

And meaning and semantics of that expression is that two is added to three.

So this is fine. Four divided by three is valid

syntactically. We're able to use this combination of

symbols. However, the meaning of this expression is

invalid. It's not possible to divide a number by

zero, and so we get a zero division error, which is a semantic error.