Flat 10% & upto 50% off + 10% Cashback + Free additional Courses. Hurry up
  • Live Instructor-led Classes
  • Expert Education
  • 24*7 Support
  • Flexible Schedule


Tokens are the smallest unit of program. There are following tokens in Python:

  • Reserved words
  • Identifiers
  • Literals
  • Operators


Reserved Words 

Reserved Words are also known as keywords which express a special meaning to the compiler and interpreter. Keywords in python are –

return or None and not
asset def class continue break
from finally elif del except
global for if else import
raise try True False pass
nonlocal in as is lambda



An identifier is a sequence of numbers and characters. These are the names given to the basic building blocks in a program. These can be class, variables, functions, object, lists, dictionaries etc.

Rules for defining identifiers are –

  • First character of an identifier can be character, underscore ( _ ) but not digit.
  • No special character except underscore ( _ ) can be used as an identifier.
  • Reserve words cannot be used as an identifier name.
  • Python is a case sensitive language so ‘a’ and ‘A’ are different identifiers.



Literals can be defined as a data that is given in a variable or constant. Python have following literals:-

  • String Literals
  • Numeric Literals
  • Floating Literals
  • Boolean Literals
  • Collection literals



A variable is a memory address that can change and when memory address cannot change then it is known as constant. Variable is a name of the memory location where data is stored. Once a variable is stored then space is allocated in memory. It defines a variable using a combination of numbers, letters and the underscore character.

There are a few rules: a variable must begin with a letter or an underscore, and the variable name is case sensitive.


Assigning Values to Variables

There is no need for explicit declaration to reserve memory. The assignment is done using the equal (=) operator. Some example of legal python variables are –

i = 1

i_j = 2


>>> a = 1

print a




Multiple Assignment:

You can assign a single value to the multiple variables as follows –

a = b = c = 20

Where a, b, c are the variable.

Also you can assign multiple values to the multiple variables as follows –

a = b = c = 20, 25, 30

print a

print b

print c





Learn more about PYTHON TOOLKIT in this insightful blog now!

Previous Next

Download Interview Questions asked by top MNCs in 2018?

Learn SQL in 16 hrs from experts

"0 Responses on Tokens and Variables"

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

Sales Offer

Sign Up or Login to view the Free Tokens and Variables.