Page 300 - Artificial Intellegence_v2.0_Class_9
P. 300

>>>b = 10.5
          >>>c = "hello"
           • Method2: Assigning different values to different variable on same line.

          >>>a = 5; b = 10.5; c = "hello"
                    OR

          >>>a, b, c = 5, 10.5, "hello"
           • Method3: Assigning same values to different variable on same line.


          >>>a = b = c = 10


                     Brainy Fact


            Python  is  a  case-sensitive  language  where  uppercase  and  lowercase  characters  have  different
            meanings. Name and name are two different variables.



        Data Types

        Data types specify the kind of a value a variable can store. It helps us to identify the kind of operation that can
        be performed on that specific data type. Every value in Python has a data type. Some of the standard built-in
        data types of Python are:

                                                            Data Types





                         Numbers                            Sequences               Sets           Maps




                 int       float    complex           string    list   tuple                     dictionary

           • Numbers: Data with a numeric value falls into this category. It can be integer, float and complex. Python will
           automatically convert a number from one type to another if needed. Following are some number types:
              ✶ Integer: Integers are whole numbers (+ve, -ve or 0) with no fractions or decimal value. Its length is dependent
              on the available memory. For example, 10, 124, 4567, 7812568751.
              ✶ Float: It is a real number with floating point representation. For example, 15.5 and 12.0. It can also be represented
              using the exponent notation E. For example, 1E5 is 100000.
              ✶ Complex: It is made up of a real number and an imaginary number. For example, 3+2i where 3 is a real number
              and 2i is an imaginary number.
           • None: This is a special data type with NULL or nothing/no value. It does not mean 0, False or empty. It is
           represented by None.
           • Sequence: It is a collection of data stored under a common name. Each value is referred by its index number. It
           can be mutable or non-mutable. There are three types of data as sequence in Python:
              ✶ String: It is a sequence of UNICODE characters enclosed in single or double quotes. Multi-line strings can be
              created using triple quotes (single or double). Its length is dependent on the available memory. It can also be
              empty where we have just empty quotes with no value. For example,

                    " "



              298     Touchpad Artificial Intelligence (Ver. 2.0)-IX
   295   296   297   298   299   300   301   302   303   304   305