Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables.
The operand to the left of the = operator is the name of the variable and the operand to the right of the = operator is the value stored in the variable.
example
counter = 42 # An integer assignment speed = 60.0 # A floating point name = "Google" # A string print(counter) print(miles) print(name)
Output
This will give the output
42 60.0 Google
example
You can also assign multiple variables in a single line.
a, b, c = 1, 2, "Hello" print(a) print(b) print(c)
Output
This will give the output
1 2 Hello