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

>=50lnndl<75                   <65000                         4000lptrleonSh
                                              >=65000                        3000lptrleonSh

               >=75lnndl<=100                 NoSlSolbtlcontidtrtd           5000lptrleonSh

          01 def scholarship(percentage, annualIncome):
          02     """
          03     Objective: To find the amount of scholarship
          04     Inputs :
          05     percentatage : percentage of marks
          06     annualIncome : Annual Income Return value: scholarship - monthly scholarship amount
          07     """
          08     if percentage < 40:
          09         scholarship = 'Nil'
          10     elif percentage >= 40 and percentage<50:
          11         if annualIncome < 65000:
          12             scholarship = 2000
          13         else:
          14             scholarship = 'Nil'
          15     elif percentage >= 50 and percentage<75:
          16         if annualIncome < 65000:
          17             scholarship = 4000
          18         else:
          19             scholarship = 3000
          20     elif percentage >= 75:
          21         scholarship = 5000
          22     return scholarship
          23 percentage = int(input("Enter your percentage : "))
          24 income = int(input("Enter the annual income : "))
          25 print('Monthly scholarship:', scholarship(percentage, income))
          26 print("Thank You, for using this program ")
        OuSpuS:

         >>> Enter your percentage : 45
         >>> Enter the annual income : 98000
              Monthly scholarship: Nil
              Thank You, for using this program
        InlShtltxnepatlgivtnlnbovt,lnnlifltSnStetnSlitlnttStdlintidtlnnoShtrlif/eliflbaock.l o,lShtlnttStdlifltSnStetnSl
        wiaalbtltxtcuStdlonayliflShtlconditonnaltxprtttionloflShtlouStrlif/elifltSnStetnSlyitadtlTrue.lAaalShtltSnStetnStl
        inlnlpnrtcuanrlbaocklnrtlindtnStdlnSlShtltnetlatvta.l


         Program 9.11  WriStl nl functonl max3(num1,l num2,l num3)l ShnSl ncctpStl froel Shtl uttrl Shrttl nuebtrtl nnd
         ditpanytlShtlanrgttSloflShtlShrttlnuebtrt.

        LtSl utl wriStl nl functonl ShnSl rtSurntl Shtl anrgttSl ofl Shrttl nuebtrt,l (tny,l num1,l num2,l nndl num3).l Wtl firtSl
        coepnrtlnum1lnndlnum2.lIflnum1 < num2,li.t.,lnum2  itlanrgtrlShnnlnum1,lwtlcoepnrtlnum2lwiShlnum3.l
        Iflnum2 < num3,lwtlhnvtlfoundlShnSlnum3  itlShtlanrgttSloflShtlShrttlnuebtrt.lHowtvtr,linlShtloShtrlcnttl
        (num2 >= num3), wtlconcaudtlShnSlnum2 itlShtlanrgttSloflShtlShrttlnuebtrt.lInlcnttlShtlSttSlnum1 < num2
        fniat,li.t.lnum2 <= num1,lwtlcoepnrtlnum1lwiShlnum3.lIflnum1 < num3,lwtlhnvtlfoundlShnSlnum3 itlShtlanrgttSl
        oflShtlShrttlnuebtrt.lHowtvtr,linlShtloShtrlcnttl(num1 >= num3), wtlconcaudtlShnSlnum1 itlShtlanrgttSloflShtl
        Shrttlnuebtrt.lWtluttlShitlnnnaytitlSolwriStlfuncton max3(num1, num2, num3),lwhichlfindtlShtlenxieuelofl
        Shrttlnuebtrtlnum1, num2,lnndlnum3.l ubttqutnSay, Shtlfuncton max3()litluttdlinlProgrnel9.11,lSolncctpSl
        ShrttlnuebtrtlfroelnluttrlnndlfindlShtirlenxieue.l
          01 def max3(num1, num2, num3):
          02     '''

         218   Touchpad Computer Science-XI
   215   216   217   218   219   220   221   222   223   224   225