Variable Declaration #
In programming, declaring a variable is a way of storing data in a variable so that we can use it later. Imagine a variable as a box that can store something inside. In the Python language, we can declare a variable using the equal sign =. For example:
a = 1
This is declaring the value of 1 to the variable named a. When the code is executed, we can use a to do something else, as shown in the example below:
a = 1
print(a) # Output: 1
Exercise #
- Create a new variable
xand assign the number10to it.
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules