Page 106 - modular4.0
P. 106

Chapter Profile
                      3.   An if statement can only execute one block of code: either the               block or the else
                          block, not both.

                      4.  In if else statement, else is followed by a               symbol.


                  C.   Write 'T' for true and 'F' for false.
                      1.   In an if-elif-else ladder, if none of the conditions evaluates to True, the

                          else block gets executed.
                      2.  Nested if statements are allowed in Python.

                      3.  Python allows multiple else blocks in a single if statement.

                      4.  Multiple conditions can be tested using if else statement.
                      5.  Indentation is not required in an if statement in Python.

                  D.   Short answer type questions.

                      1.  How do you check if a condition is true in Python?


                      2.  Write an if statement in Python to check if the given number is greater than 0.



                      3.  Write the syntax of if…elif… else statement.












                  E.   Long answer type questions.
                      1.  How do if, elif, and else work together in Python?











                      2.  Write a Python program to check if a person is eligible to vote (18 years or older is eligible).








                104  Modular (Ver. 4.0)-VII
   101   102   103   104   105   106   107   108   109   110   111