Page 247 - AI Computer 10
P. 247

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 different 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: 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:








         u Sequence: Sequence is a collection of data (mutable or non-mutable) stored under a common name. There
             are three types of data as a sequence in Python are:

             •  String: A string is a sequence of one or more letters or characters enclosed is thin single or double
                quotes. In Python, we can create empty string by just writing empty quotes with no value and multiline
                string using triple quotes as shown.












                                                                                                             113
                                                                                                             113
   242   243   244   245   246   247   248   249   250   251   252