Page 133 - TechPluse_C8_Flipbook
P. 133

elif (Test Expression_2):

                     Indented block 2
                 elif (Test Expression_3):

                     Indented block 3

                 else:
                     Indented block


                 Program 7: To check whether a given number is two-digit number, three-digit number or four-
                 digit number.




















                 On running the above program, we get the following output:




















                 Program 8: To print the message based on the marks entered. Display the messages:
                 1.   ‘Sorry!!!, You are failed in the exam’, if the marks are less
                     than 35,

                 2.   If the marks are less than or equal to 60 display the message ‘Passed with C grade’
                 3.   If the marks are greater than 60 and less than or equal to 85 display the message ‘Passed
                     with B grade’.

                 4.   If none of the condition evaluates to true, then display the message ‘Passed with A
                     grade’.







                                                                Conditional and Looping Statements in Python         131
   128   129   130   131   132   133   134   135   136   137   138