Page 136 - TP_Plus_v4_Class7
P. 136

True    Indented
                                          Test Expression 1          block 1


                                                   False

                                                            True    Indented
                                          Test Expression 2          block 2


                                                  False


                                                            True    Indented
                                          Test Expression 3
                                                                     block 3

                                                  False             Indented
                                                                      block


                                                                           Statement just below
                                                                            if...elif...else ladder

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

                   Program7.py
                File  Edit  Format   Run   Options   Window    Help

                #Program to check the given number is two digit, three digit or four-digit number.
                num = int(input('Enter a number: '))
                if(9 < num <= 99):
                    print('Two digit number')
                elif(99 < num <= 999):
                    print('Three digit number')
                elif(999 < num <= 9999):
                    print('Four digit number')






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

                   Output
                Enter a number: 23
                Two digit number


                Enter a number: 345
                Three digit number


                Enter a number: 4564
                Four digit number





                  134  Plus (Ver. 4.0)-VII
   131   132   133   134   135   136   137   138   139   140   141