Page 227 - Computer Science Class 11 With Functions
P. 227

l     (iii)l if value == 10:

                     square = value*value
                     print("The square of ", value,"is",square)
                     else:
                     print("Wrong value entered")
             Ans.  (i)l IncorrtcSllcnttloflktywordtl– if, elif nndlelse
                    l If value == 10:lllllllllllllllllllllllllllllllllllllll------l>l'I'loflktywordliflitlinlupptrlcntt
                    l lllllllllllsquare = value*value
                  (ii)l ThtlhtndtrlitlnoSlStreinnStdlwiShlnlcoaonl(:)
                    l if value == 10 llllllllllllllllllllllllllllllllllllll  llllllllllll ---l>lcoaonleitting
                    l lllllllllllsquare = value*value

                  (iii)l NoSlindtnSinglShtltSnStetnStloflif / else / elif baocktlcorrtcSay
                    l if value == 10:
                    l square = value*value
                      print("The square of ", value,"is",square)l--->WronglindtnSnSion
                    l else:
                      print("Wrong value entered")l--->WronglindtnSnSion
               9.  RtwriStlShtlfoaaowinglcodtlSolenktliSltxtcuSnbatlbylchnngingljutSlontlSoktn.

                 if x = 10:
                     print(x)
                 elif:
                     print(x*x)
             Ans.  if x == 10:
                      print(x)

                  else:
                      print(x*x)
              10.  FindlShtlouSpuSloflShtlfoaaowinglcodtltnipptSlforlShtlfoaaowinglvnauttloflytnrlprovidtdlbylShtluttr:
                  n.l2020l                 b.l2051l               c.l2100

                  year = int(input('Enter the year of Christian Era'))
                  if year % 100 == 0:
                      if year % 400 == 0:
                          print('Leap Year')
                  elif(year % 4 == 0):
                      print('Leap Year')
                  else:
                      print('Not a Leap Year')
             Ans.  n.l LtnplYtnr

                  b.l NoSlnlLtnplYtnr
                  c.l NolouSpuSlwiaalbtlproductd








                                                                                          Conditonnal SnStetnSt  225
   222   223   224   225   226   227   228   229   230   231   232