Page 249 - AI Ver 3.0 Class 11
P. 249

10. Predict the output:

                          a.  x = 75
                           if x > 100:
                               y = x * 0.20
                           elif x > 50:
                               y = x * 0.10
                          else:
                               y = x * 0.05
                          print(y)
                          b.  count = 0
                           for i in range(1, 6):
                               if i % 2 == 0:
                                   count += 1
                               else:
                                   count += 2
                          print(count)
                          c.  a = 3
                           b = 4
                           for i in range(1, 4):
                               if a > b:
                                   a -= 1
                               elif a < b:
                                   b -= 1
                               else:
                                   a += 1
                          print(a, b)



















                 Answers

                 Exercise (Section A)
                 A.  1.  b   2. c    3.  a     4.  b      5.  a      6.  b     7.  c     8.  c      9.  b     10.  c
                    11.  b   12. d   13.  a   14.  b     15.  b     16.  c    17.  c    18.  b     19.  c     20.  b
                 B.  1.  modules, packages  2.  Interactive mode   3.  .py          4.  Tokens
                    5.  Sequence          6. for loop              7.  Imputation   8.  metadata
                    9.  PCA (Principal Component Analysis), LDA (Linear Discriminant Analysis)  10.  KNN
                 C.  1.  False    2.  True        3. False        4. True         5. False        6. False
                    7.  True      8.  True        9. False       10. True


                                                                                         Python Programming     247
   244   245   246   247   248   249   250   251   252   253   254