Data Science
  • Data Analytics Explore Data Analytics
  • Data Science Explore Data Science
  • Machine Learning Explore Machine Learning
Digital Course
  • Digital Marketing Explore Best Digital Marketing Course
  • SEO Explore Best SEO Course
  • C Explore C
  • C++ Explore C++
  • Python Explore Python
Microsoft Office
  • Advanced Excel Explore Advanced Excel
Data Visualization Tool
  • Power BI Explore Power BI
  • Tableau Explore Tableau
Web Development
  • MERN Stack Explore MERN Stack
  • Php Web Development Explore Php Web Development
  • Django with Python Explore Django with Python
  • Web Designing Explore Web Designing

What is Variable, Keyword, and Data Type?

  1. Home
  2. »
  3. Programming Language
  4. »
  5. What is Variable, Keyword, and Data Type?

Variables are used for various data. In simple words, the variable is like a container that is

used for storing data.

Rules for variable name:-

1. Variable names can be written with the help of (A to Z), ( a to z), ( o to 9), ( _ ).

Example:- Number1= (it is valid),

 Number@1= (it is not valid)

2. Variable names do not start with a number.

Example:- Num1= (it is valid),

 1Num= (it is not valid)

3. Variable name does not contain white space.

Example:- First name= (it is not valid)

 First_name= (it is valid)

4. Keywords can not be used as variable names.

Example:- if= (it is not valid)


The keyword is those words that are predefined in Python. It is also known

as the reserved word. There are 35 keywords in Python which are the following:-

‘False’, ‘None’, ‘True’, ‘and’, ‘as’, ‘assert’, ‘async’, ‘await’, ‘break’, ‘class’, ‘continue’, ‘def’, ‘del’, ‘elif’, ‘else’, ‘except’, ‘finally’, ‘for’, ‘from’, ‘global’, ‘if’, ‘import’, ‘in’, ‘is’, ‘lambda’, ‘nonlocal’, ‘not’, ‘or’, ‘pass’, ‘raise’, ‘return’, ‘try’, ‘while’, ‘with’, ‘yield’

Notes:- You don’t need to cram it. Just require to type the following command to

get the list of Python keywords.


import keyword

print(keyword. Kwlist)

Data Type

The data type is used to define which type of value variable will contain.

There are 10 main data types in python

1. INT

Any number which does not have any decimal value

Example: – 56, 789, -66, etc.


Any number which must contain the decimal value

Example: -78.67, 789.76, 7.0


 It concedes only one string parameter. If the opening argument is a string type, it will not acknowledge assigning the second argument. It produces an error if we pass the second parameter.It contains “(5+7j)” kind of number


Boolean contains either “True” or “False”

5. STR

The string is a character or a combination of characters. It periodically writes in (‘ ‘), (“ “),

(‘’’ ‘’’), (“”” “””).

Examples: “python”, ‘Dreamer Infotech’, etc.


It is a collection of heterogeneous data types. It is uncertain or unreliable. It is defined in “ [ ] “.

Example: [“Python”, 56.32, 55, True, (6+3j)]


It is used to generate a sequence of numbers over time. It is defined as a range(start, end, step-size)

The default step size is 1.

Example: range(1,10,2), range(1,10)


It is similar to the list. But it is immutable or unchangeable in nature. It is defined in “ ( )”.

Example: (4, 5.3, “Python”, True)


The dictionary is a collection of keys and their values. The key must be unique but

value can be duplicated.

It is defined by {“key”: “value”}.

Example: {“Name”:” Nitesh”, “Age”:23}

10. SET

A Set is also a collection of heterogeneous elements. Set items are unordered,

unchangeable, and do not allow duplicate values.

It is defined by “ set()”.

Example: set(34,6.8,True, “Python”)

How to check the Datatype of a variable





Basic Inbuilt Function

1. print(): print() function is used to display the output as a result.

2. input(): input() function is used to accept input from the user.

3. type(): type() function is used to check the data type of the variable.

Join Dreamer Infotech to Learn Python Training Course in Faridabad.

Share on Facebook
Share on Twitter
  • Express Entry
  • Express Entry
  • Express Entry
  • Express Entry
  • Express Entry
Call Now Button