Page 142 - Trackpad_V1_Book 7_Flipbook
P. 142

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

                  SETS

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

                  SEQUENCE

                  A sequence is an ordered collection of items of similar or different data types. The three types of
                  sequence data types are Strings, Lists and Tuples.

                  Strings

                  A string is a sequence of one or more characters put in single quotes, double quotes or triple quotes
                  which are 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 same or different data elements.

                  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 a list can be modified but a tuple cannot be modified after it is
                  created.

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



                             FIND DATA TYPE


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

























                  140   Trackpad (Version 1.0)-VII
   137   138   139   140   141   142   143   144   145   146   147