Python Legal Variable Names

Python Legal Variable Names

A variable is a short name which store a data in like X and Y. Or you can explain a variable with a age, firstname, lastname, total_value and etc. In python when you start to write a variable you should follow the rule before defining a variable.

 Python Variable Rules

  • A variable must be starting a latter or underscore character. For example (myvar = “GSSTECH”)
  • A variable name can’t be s tart a number like (2myvar = “GSSTECH”).
  • A variable name should be alpha-numeric character and underscore. Like (a-z, 0-9 and _.
  • Python variables are case sensitive its mean when you declare a variable like age and 2nd variable AGE these are two different variables.

Python Variables Examples:

myvar = "GSSTECH"

my_var = "GSSTECH"

_my_var = "GSSTECH"

Myvar = "GSSTECH"

myVar = "GSSTECH"
myVar2 = "GSSTECH"

Leave a Reply