Table of Contents for this Page
- Common Variable types
- Python’s built in type function
- Naming Conventions for Variables (snake vs camel case)
Python supports the basic types of variables that you would expect from a general purpose language. These are listed below.
- floating point
- String (more here)
- List (more on lists here)
Example Code 1
As you can see in example code 1 above, you do not need to do anything special to create a string variable versus creating a boolean variable .
Python does classify each variable’s datatype based on its value. You can always check the data type of a variable by using the Python function type as shown in code below.
Example Code 2
As example code 2 shows, can see above, the type function returns the datatype of a variable. Maybe you’re wondering why there’s even a need for the type function…we will talk more about that soon.