Variable assignment in Python

When you start learning  any programming language like C, C++, Java, Angular, Variable assignment is the first thing which you start to learn.

employee_id = 110990

Here, We have created variable “employee_id” with assignment operator “=” and assigned number 110990.

If you  have knowledge about other languages like Java, you can see following difference between Java and Python.

  1. We don’t need to declare “employee_id” before using it.
  2. We don’t need to tell Python and the employee_id will be Number or String or Boolean. We can also reassign the variable with String in future whenever you need it.
  3. This way of declaration is known as “dynamic typing”.

To print the value of variable you can use inbuilt Python function “print”.

print(employee_id)                    // prints 110990

This will print the value of employee_id to the screen,

 

Join Discussion

This site uses Akismet to reduce spam. Learn how your comment data is processed.