Data Types and Keyword in Python

 

Data Types in Python

  1. It is a type of data which is used in the program.
  2. There is no need of data type to declare a variable in Python.
  3. type() is predefined function of Python which is used to get data type of any data.

name="Rocky"
rollno=205
marks=85.6
print("Name Type:",type(name))
print("Rollno Type:",type(rollno))
print("Marks Type:",type(marks))
"""
***Output***
Name Type: < class str="">
Rollno Type: < class int="">
Marks Type: < class float="">
"""

Types of Data Type

  • Python contains following data types:
  • Numbers
  • String
  • List
  • Tuple
  • Dictionary
We will discuss these data types in next post one by one because each data type is a complete topic in itself.

Keywords in Python

  1. The word which is pre-defined in the library is called keyword.
  2. It's functionality is also pre-defined.
  3. Keyword can not be used as a variable, function name ,class name or as an any identifier.
  4. Example of keywords are if, else, for, def etc.

List of keywords in Python

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