Page 195 - Ai Book - 10
P. 195

Data Types

        A data type is an attribute that tells the computer what kind of data a variable can have. The concept of data type
        is mostly used in those programming languages where the type of variable is known at compile time. Each data
        type requires different amounts of memory and has some specific operations which can be performed over it.
        Some of the commonly used data types in Python programming language are as follows:

                                                           Python
                                                          Data Types



                                                                       Mapping
                                  Numeric      Boolean       Set      (dictionary)  Sequence





                       Integer     Float       Complex                  String       List       Tuple

        Let us learn some of the standard built-in data types of Python.

         u   Numeric: Numeric data types are used for arithmetic or numerical operations. The two most commonly
             used numeric data types in Python are integer, float and complex.








         u   Boolean: The Boolean data type can be used to represent one of the two values and these values are: true
             or false. Mostly it is used to draw a comparison between two values. For example:










         u   Set:  Set is a mutable, unordered collection of values of any type with no duplicate element. For example:







         u   Maps (Dictionary): Maps are unordered type of data used for mapping keys with its corresponding values.
             For example:










                                                                                                              69
                                                                                                              69
   190   191   192   193   194   195   196   197   198   199   200