Operators
Here are the operators you need to know.
Category | Operators |
Arithmetic | +, -, *, /, //, **, % |
Relational | <, <=, >=, >, ==, != |
Assignment | +=, -=, *=, /=, //=, **=, %= |
Logical | and, or, not |
See
here for more detail on
integer division // (also known as
floor division).
See
here for more detail on the
mod operator %.
Functions
See here.
Here are some built-in functions.
print("Type conversion functions:")
print(bool(0)) # convert to boolean (True or False)
print(float(42)) # convert to a floating point number
print(int(2.8)) # convert to an integer (int)
print("And some basic math functions:")
print(abs(-5)) # absolute value
print(max(2,3)) # return the max value
print(min(2,3)) # return the min value
print(pow(2,3)) # raise to the given power (pow(x,y) == x**y)
print(round(2.354, 1)) # round with the given number of digits
To check what kind of built-in functions Python has, see the official Python documentation
here.
Conditional Statements
See here.
Some guidelines on correct usage of conditional statements can be found
here.