Variables
- Variables are used to name an object reference.
- The variable name is the map that directs the program to the object. This is known as the object reference.
- Variable names are usually written in snake_case to make it easier to read.
Ints
- This week, we focused on two types of variables: int and double.
- Ints are a type of variable.
- They store numbers that are not fractions or decimals.
Doubles
- Doubles are another type of numerical variables
- They store numbers that are fractions or decimals.
Differences Between an Int and a Double
- ints are used for whole numbers only
- doubles are used for decimal numbers only
- Remember: Use 2.0 or 1.0 for double only when you want to the result of your program to be a decimal. Otherwise use int for whole numbers
Operations
- Operations are used in addition to defining a variable.
- These operations are very useful because you use them every day!
- EX: + (addition) , - (subtraction), * multiplication
- The computer is so smart that it can perform these operations like a calculator that you use in school.
- Here is are examples that can be used in Python: