Python – Variables and Operators
Variables
Python does not have a particular syntax or command for creating or declaring variable. A variable is created at the moment we assign a value to it.
Ex: x=4
Here variable ‘x’ is assigned with value 4 and is considered integer.
x=”John”
Here variable x is assigned string value.
So, we dont have separate syntax for declaring a variable. The moment we assign a value, the variable is declared with the type of value we assigned.
Conditions to name the variable:
- Must contain numbers, letters, or underscores
- Should not start with the number
- Spaces are not allowed
- Cannot be keywords of Python like print, break, etc.…
- Case sensitive
- Short and descriptive are best.
Operators:
We can perform arithmetic operations using arithmetic operators.
ex: print(10+5)
Here addition will be done, and we will get output as 15.

The same way we can use other operators like logical,assignement and comparision operators.
Conditional Operators:
To execute statements based on conditions, we use this. The conditional operators are “if”,”if-else”,etc..
Some condition based executions are:

Just introduced how variables and operators are used in Python language.