Summary
In this lab, we covered several major important topics. Let’s quickly review them.
Data Types in Python
str
data type stores text (strings). Usestr(expression)
to convert an expression to a string if possible.int
data type stores whole numbers (integers). Useint(expression)
to convert an expression to an integer if possible.float
data type stored decimal numbers (floating-point). Usefloat(expression)
to convert an expression to a floating-point value, if possible.
Math Operators in Python
+
Addition-
Subtraction*
Multiplication**
Exponentiation (Power)/
Division//
Integer Division%
Modulo (the remainder of division)
Python Order of operations
- Parentheses
- Exponentiation
- Multiplication, Division, Integer Division, and Modulo from left to right
- Addition and Subtraction from left to right