Variables in Python are programmer provided (hopefully user friendly) labels that store a value. Python is a dynamically typed language, which means that the variable is not tied to a particular type of data. For example, if you have a variable named “x” it can hold numeric values like (123123) or a string value like (“car”) or a boolean value like (True).
1) Types of Variables
Here is a Table containing the various data types available in Python
Data Type | Description | Example Values |
Integers | Numbers without decimal points. Can be any size. It is constrained only by the memory in your computer. | 1 100 10000 1000000000000000000000000000000000000000000 |
Floating Point Numbers | Numbers that require a decimal point. Can use scientific notation (eg .4e5 which is the same as 40000.0) | 1.0 2.20 4.2022323234 1.2e-4 (same as .00012) |
Boolean | Can hold one of 2 values: True or False | True False |
Strings | A sequence of characters. Are delimited by either single quotes (‘) or double quotes (“) | ‘Hello’ “Hello” ‘Apollo 11’ ‘John\’s computer’ “John\’s computer” |
2) Create an Integer
#Integers
x = 100
print(x)

3) Create a Float
#Floating Point
x = 100.23
print(x)

4) Create a Boolean
Boolean
x = True
print(x)

5) Create a String
#String
x = "Hello"
print(x)

- Python Lesson 1: Hello World in Python
- Python Lesson 2: Reserved Keywords
- Python Lesson 3: Creating Variables
- Python Lesson 4: Performing math calculations in Python using operators
- Python Lesson 5: Working with Strings
- Python Lesson 6: Useful String Methods
- Python Lesson 7: Getting User Keyboard input
- Python Lesson 8: Importing Modules into your Python code
- Python Lesson 9: Decision making in Python
- Python Lesson 10: Creating loops in Python
- Python Lesson 11: Lists in Python
- Python Lesson 12: Tuples in Python
- Python Lesson 13: Dictionaries in Python
- Python Lesson 14: Sets in Python
- Python Lesson 15: Dealing with dates and time
- Python Lesson 16: Creating and using functions
- Python Lesson 17: Creating and using classes in Python
- Python Lesson 18: List Comprehensions
- Python Lesson 19: Lambda Functions
- Python Lesson 20: Error Handling