Page 94 - TP_V5.1_C7_fb
P. 94

SETS
                  Set is a mutable, unordered collection of value, of any type, with no duplicate element.


                  Dictionary
                  These are kind of key-value pairs. Key can be numbers or strings and values can be any arbitrary

                  Python object. Dictionaries enclosed by curly braces and values can be assigned and accessed
                  using square brackets.

                  SEQUENCE
                  A sequence is an ordered collection of items of similar or different data types. The three types of
                  sequence data types are String, List and Tuple.


                  String
                  A string is a sequence of one or more characters enclosed in single quotes, double quotes or triple
                  quotes which is used to represent text-based information. The quotes are not a part of the string.


                  List
                  A list is a collection of data elements separated by comma(,) and enclosed within square brackets.
                  We can also create a list with the elements that are the same or have different data types.


                  Tuple
                  A tuple is just like a list. It contains a group of elements that can be of different data types. The
                  elements in the tuple are separated by comma and enclosed in parentheses (). The difference
                  between a list and a tuple is that list can be modified but tuples cannot be modified after it is created.

                  BOOLEAN

                  Boolean is a data type with two built-in values: True or False. It is used in logical evaluation. A
                  True statement returns value 1 while a False statement returns value 0.




                            FIND DATA TYPE

                  Python allows us to find out the type of data used in a program by using type() function.
























                   92   Premium Edition-VII
   89   90   91   92   93   94   95   96   97   98   99