Page 37 - tp_Modula_v2.0
P. 37

On running the above program, you will get the following output:

                     Output

                  Enter a number: 98
                  Two digit number


                  Enter a number: 898
                  Three digit number


                  Enter a number: 7989
                  Four digit number


                  Enter a number: 98697
                  Five digit number







                     SOME MORE PROGRAMS


                 Program 5: To demonstrate the if statement.

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







                 On running the above program, you will get the following output:

                     Output

                  How many days are there in a leap year?365

                  How many days are there in a leap year?366
                  Your answer is correct, Good Job















                                                                               Conditional Statements in Python   35
   32   33   34   35   36   37   38   39   40   41   42