Page 1 - LN
P. 1

Lesson Note



                                             Computer Science

                                                       Class - XI

                                          Chapter – Data Handling



               A data type, in programming, is a classification that specifies which type of value a variable has
               and what type of mathematical, relational or logical operations can be applied to it without
               causing an error.
               A string, for example, is a data type that is used to classify text and an integer is a data type
               used to classify whole numbers.
               Arithmetic operators will work with numbers but not string.
               Built in core data types available in Python are:
                   •  Numbers (int, boolean, float, complex)
                   •  String
                   •  List
                   •  Tuple
                   •  Dictionary

               Data Types
               Data type tells the compiler/interpreter how the programmer intends to use the variable/data
               in it.
               Built in core data types available in Python are:
                   •  Numbers (int, boolean, float, complex)
                   •  String
                   •  List
                   •  Tuple
                   •  Dictionary

               Integer
               Can store both positive and negative integers (no decimal part) of any length (limitation is,
               available memory )
               Ex.       235, -4579, 1537000
                                0o457, 0O306  (Octal , 0-zero, o/O-letter)
                                0x69A, 0X5B8 (Hexadecimal, 0-zero, x/X-letter)
                         25,900      #invalid as , not permitted


               Boolean
               Boolean represents truth value TRUE/YES/1 or FALSE/NO/0
               A Boolean literal is a literal having or two possible values True or False
               bool returns the boolean equivalent of 0 or 1.
               Ex.
               >>>bool(0)
               False
   1   2   3   4   5   6