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

'''
                       Objective: To accept marks in English,   Hindi,   Maths,   Science and Social
                      Science and display the grade
                      Input Parameters: None
                      Return Value: None
                      '''
                       # Approach: The main function makes use of function grade to compute grade based
                      on the marks entered

                      marksEnglish = int(input('Enter marks scored in English :  '))
                      marksHindi = int(input('Enter marks scored in Hindi :  '))
                      marksMaths = int(input('Enter marks scored in Maths :  '))
                      marksSc = int(input('Enter marks scored in Science :  '))
                      marksSSc = int(input('Enter marks scored in Social Science :  '))
                       print('Grade:', grade(marksEnglish, marksHindi, marksMaths, marksSc, marksSSc))

                  main()
               4.  MurShylitlatnrninglnbouSlSrinngattlinlenShtenSict.lHtlknowtlShnSlShtltueloflnaalShrttlinStrnnalnngattloflnlSrinngatlitl180.l
                  Thtrtfort,lllhtlwnnStlSolwriStlnlprogrnelinlPyShonlShnSlncctpStl3lnngattlinldtgrtttlnndlprinStlwhtShtrlShtlgivtnlnngattl
                  forelnlSrinngatlorlnoS.lHtaplhielcoepatStlShtlSntk.l
             Ans.  def isTriangle(angle1, angle2, angle3):
                      '''
                      Objective: To check whether the given angles form a triangle
                      Input Parameters: angle1,   angle2,   angle3 in degree
                      Return Value: True,   if given angles form a triangle
                                    False,   otherwise
                      '''

                      return angle1+angle2+angle3 == 180

                  angle1  = int(input('Enter a first angle in degrees:  '))
                  angle2  = int(input('Enter a second angle in degrees:  '))
                  angle3  = int(input('Enter a third angle in degrees:  '))
                  flag = isTriangle(angle1,   angle2,   angle3)
                  if flag == True:
                      print('Given angles form a triangle')
                  else:
                      print("Given angles don't form a triangle")




                                                     Assessment


            A.  Multiple Choice questions
               1.  WhtnlShtltxtcuSionlofltSnStetnStlinlnlprogrneldtptndtlonlShtltvnaunSionloflnlcondiSion,lfaowloflconSroallitlknownlntl
                  ____________lfaow.
                  n.l IStrnSivtl           b. CondiSionnal        c.  tqutnSinal        d. Loopingl





                                                                                          Conditonnal SnStetnSt  229
   226   227   228   229   230   231   232   233   234   235   236