Page 93 - TP_V5.1_C7_fb
P. 93

DATA TYPES


                 Data types are used to define the type of value a variable can contain. Each variable in Python
                 is associated with a data type. Each data type requires a different amount of memory and
                 has some specific operations performed on it.  Data types are divided into four categories as
                 shown below:



                                                                   Data Types







                                   Numbers                  Sets              Sequence               Boolean






                     Integer/long                Float               String                   List



                                   Complex               Dictionary              Tuple




                 NUMBER
                 Integer numbers, floating-point numbers and complex numbers are the built-in numeric data
                 types of Python.


                 Integer/Long

                 Integers are whole numbers consisting of + or – signs. They do not have decimal places between them.




                         uiz   Bee        What is the use of the AND operator in Python?
                                          _________________________________________________________________




                 Float
                 Float data type represents numbers that contain a decimal point. For example, 0.6, -3.257 are
                 called floating-point numbers. These numbers can also be written using ‘e’ or ‘E’ to represent the
                 power 10.

                 Complex

                 A complex is a number that is written in the form a+ bj or a+bJ. It is represented as follows:
                 (real part) + (imaginary part) j.



                                                                                    Tokens and Data Types in Python  91
   88   89   90   91   92   93   94   95   96   97   98