DEV Community

loading...
Cover image for Python Basics Again: Variable, expression, Statements, Conditionals and Functions

Python Basics Again: Variable, expression, Statements, Conditionals and Functions

geekaizer profile image Omni Kai ・1 min read

A variable refers to a value.

a = 2

An expression is a combination of values, variables and operators.

a+2-2

A statement is a unit of code that has an effect on your code like the print statement.

print(a)

Python follows the PEDMAS order of operations.

Python data types: integar(int), string(str), float
(float) and boolean which is often debatable.

Conditionals (if,else,elif) state conditions your code must follow.

Functions help you reuse code instead of writing it over and over and it begins with a def. In-built functions like math comes already baked in python.

You can call the functions you create between different scripts.

Alt Text

Discussion (0)

pic
Editor guide