Basic HTML Version

|  | Table of Contents |  | View Full Version

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

    Indented statement block

                     # if block ends here
                      Âõ÷rfÃkerzÞk

                       ÃkkÞÚkkuLk{kt, þqLÞ rMkðkÞLkk {qÕÞLku Mkk[wt íkhefu yÚko½xLk fhðk{kt ykðu Au. Lkk yLku 0 Lku ¾kuxkt íkhefu yÚko½xLk fhðk{kt ykðu Au.

                     «kuøkúk{ 1: ykÃku÷ MktÏÞk ÄLk Au fu Lknª íku íkÃkkMkðk {kxu.

                         Program1.py

                      File  Edit  Format   Run    Options   Window    Help

                      #Program to check if a number is positive
                      n = int (input ('Enter a number:'))
                      if(n > 0):
                          print('Entered number is positive')

                      #Statement outside the if statement
                      print('All numbers greater than 0 are positive')

                     WÃkhkuõík «kuøkúk{ hLk fhðkÚke, ykÃkýLku Lke[u {wsçkLkwt ykWxÃkwx {¤u Au:

                         Output

                      Enter a number:6
                      Entered number is positive
                      All numbers greater than 0 are positive

                      Enter a number:-9
                      All numbers greater than 0 are positive

                     «kuøkúk{ 2: òu Mxux{uLx Ëþkoððk.

                         Program2.py
                      File  Edit  Format   Run    Options   Window    Help

                      #Program to display the message using if statement
                      days = int(input('How many days are there in a leap year? '))

                      if(days == 366):
                          print('Your answer is correct, Good Job')

                                                                                            ÃkkÞÚkkuLk{kt fLzeþLk÷ Mxux{uLx  99

| 96 97 98 99 100 101 102 103 104 105 106 |