Python Variables

A variable is a name that refers to a value. Variables point to the memory location where data is read and modifier.

  • Variables in Python are place holders.
  • Python Variable names must start with character or _(underscore). But, not with numbers.
  • Keywords cannot used in Python variables declaration.
  • Variables are created when they are first assigned values.
  • Python Variables are replaced with heir values when used in expressions.
  • Variables must be assigned before they can be used in expressions.
  • Python Variables refer to objects and never declared ahead of time.
  • Python variables are case sensitive

Examples:

>>>x=2 >>>y=7 >>>c=x+y

Following variables declaration is valid in Python.

var1=100 asas=200 var_1=100 _name=9

Following variables declaration is not valid in Python

1var1=100 $asas=56 var-1=1