Coding Pirates

Lesson 4

Operators and decisions

Operators are the symbols that do something with values.

Math

+ - * /

// whole division, % remainder, ** power

Comparing

== equal, != not equal

< > <= >=

The answer is always True or False.

Combining

and both must be true

or at least one

not flips it

Comparisons are how a program decides things, with if. Everything indented under the if only runs when the comparison is True.

if gold >= 100:
    print("You are rich!")
else:
    print("Keep looking.")
1 / 3