Python Variables

Python Variables:

Variables are used in python to hold a value at a memory location. Python is a type infer language, i.e the data type of the variables do not need to be declared. It automatically detects the types in accordance with the variable value. Creating a variable is also not a tedious task in python; just need to assign a value to the variable name.

Rules for a Variable Name in Python:

  •  A variable name should not be a keyword.
  • A variable name can begin with a letter or an underscore only.
  • A variable name can contain both numbers and letters along with underscores (A-z, 0-9, and _ ).
  • A Variable name in Python is case-sensitive i.e, sum and Sum are two different variables.

Features of a Python Variable:

  • Python variables can be created whenever required. There is no boundation in declaring a variable in python.
  • Python variables supports multiple assignment in a single statement i.e, user can assign single value to multiple variables or multiple values to multiple variables in a single statement.

Printing “HELLO WORLD” in python using Interactive Mode and using a Variable.

Please follow and like us:
Content Protection by