In Python we don’t have to declare explicit variables of type integer or string

A variable is created when you first assign a value to it.

x = 50
y = "sachin"

In above code the time we assigned value 50 to x ; x variable is created of type integer and “sachin” to y ; y variable is created as string.

you can check variable type by using type() function

You can see type(x) is showing int and type(y) is string


Variable name can be like short names (like a or  b) or more descriptive like (country_name,subject,person_age) etc.


  • A variable name should be start with a letter or the underscore( _ )
  • A variable name can be alpha-numeric characters and underscores (a-z, 0-9,A-Z and _ )
  • A variable should not be start with a number
  • Variable names are case-sensitive (name, NAME and NaMe all three will be treated as different variable)