Python: Variables

Python has some simple variables.

myString = 'Hi'
myWholeNumber = 7
myDecimalNumber = 4.5

Note that Python uses floor division when no floating point number is present. So if you want a float result use at least one float input.

n1 = 50
n2 = 4.0
print n1 / n2

The result would be 12.5

Operators

The following operators perform addition, subtraction, multiplication, division and exponentiation.

+ - * / **

When more then one operator is used it follows the PEMDAS rule (Parentheses, Exponentiation, Multiplication and Division, Addition and Subtraction)

Navigation
Print/export
Toolbox