Page 103 - KEC Khaitan C8.5 Flipbook
P. 103

elif (conditional expression):
                             statement(s)
                     else:

                             statement(s)


                                                   Start



                                                                True
                                                if condition 1         Statement 1


                                                      False

                                                                True
                                                if condition 2         Statement 2


                                                      False

                                                                True
                                                if condition 3         Statement 3

                                                      False
                                                                       Statement



                                                                                     Stop


                 Program 4: To grade a student according to his/her marks

                     Program4.py
                  File  Edit  Format   Run    Options   Window    Help

                  #Program to grade a student according to his/her marks
                  marks = int(input('Enter marks: '))
                  if(marks >=90):
                      print('Grade A+')
                  elif(marks >=80):
                      print('Grade A')
                  elif(marks >=70):
                      print('Grade B+')
                  elif(marks >=60):
                      print('Grade B')
                  elif(marks >=50):
                      print('You can do better!!!')
                  else:
                      print('You need to work hard!!!')






                                                                                        Control Structures in Python  101
   98   99   100   101   102   103   104   105   106   107   108