Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 106 - Gujrati Play V2.0 Class 7 Flipbook
P. 106

    IF…ELIF…ELSE Mkeze

                      if…elif…else Mkeze yu if Mxux{uLxLkku çkeòu «fkh Au. íku ykÃkýLku çknwrðÄ ÂMÚkríkykuLkwt Ãkheûký fhðk{kt {ËË fhu Au yLku WÃkhÚke Lke[u
                      MkwÄeLkku yr¼øk{ yÃkLkkðu Au. yk{kt, if Lke rMÚkríkLkwt {qÕÞktfLk ÚkíkktLke MkkÚku s, íku ‘if’ MkkÚku Mktf¤kÞu÷ RLzuLxuz ç÷kuf yuÂõÍõÞwx ÚkkÞ Au, yLku
                      çkkfeLke Mkeze xk¤ðk{kt ykðu Au.

                      òu fkuRÃký þhík Mkk[e Lk ÚkkÞ, íkku ytrík{ else Mxux{uLx yuÂõÍõÞwx ÚkkÞ Au.
                      if...elif...else MkezeLkku ðkõÞh[Lkk Lke[u çkíkkðu Au:

                      ðkõÞh[Lkk:                                               Start

                      if (Test Expressions_1):
                          Indented block 1
                                                                                            True
                                                                            if condition 1          block 1
                      elif (Test Expression_2):

                          Indented block 2                                        False

                      elif (Test Expression_3):                                             True
                                                                           if condition 2            block 2
                          Indented block 3
                                                                                  False
                      else:

                          Indented block                                                    True
                                                                           if condition 3            block 3

                                                                                  False
                                                                                                      block

                                                                                                                 Stop

                      «kuøkúk{ 7: ykÃku÷ MktÏÞk çku-ytfLke MktÏÞk Au, ºký-ytfLke MktÏÞk Au fu [kh-ytfLke MktÏÞk Au íku [fkMkðk {kxu.

                          Program7.py
                       File  Edit  Format   Run    Options   Window    Help

                       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')

                      104       Play (Ver. 2.0)-VII

| 101 102 103 104 105 106 107 108 109 110 111 |