Python : Crash Course Part 2 – Variable Assignment

Have you tried out the arithmetic operations on python yet ? If not, I strongly recommend you to visit the first part of the crash course. For the rest of you, let’s get started.

The assignment operator in python is the “equal to” ( = ) sign as shown below:

In [1]: var = 2
In [2]: var
Out[2]: 2

Some more examples:

In [3]: X=4
In [4]: X+Y
Out[4]: 14

If your variable comprises of multiple words then separate the words with a “under score” ( _ ) symbol as shown below :

In [5]: multiple_words_var = 10


1) Variable names shouldn’t start with numbers.
2) Variable names cannot start with special symbols as well.
3) Variable names are case sensitive.

Feels like we are using C programming, aren’t we ? It’s that simple. Let’s go to strings now.