Saturday, 4 January 2020

Variables in Python

Introduction:
    Variables are containers that hold values in the computer memory; We use variables in our program for various kind of manipulations.
    Variables are containers for holding values of different data types.
    The variable might be belonging to any of the data types like Numbers, String, List, Tuple, Dictionary, etc.
    The value of the variables may change in the program.
    Python is a dynamically typed language, so the declaration of data type is not required. See Duck Typing

Rules for naming variable:
      1. Variable names are case-sensitive.
               In this, uppercase and lowercase letters in the variable name treated as distinct. That's why result, Result, RESULT are three different variable names.

2. A variable name must start with a letter or the underscore character.
               A variable name cannot start with a number.

      3. A variable name can only contain alpha-numeric characters (A-z, 0-9) and underscores ( _ ).



We assign value to the variable using the Assignment operator (=).
Python also allows us to assign values to multiple variables in a single line.