Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 139 - 2626_South Point_C-7
P. 139

    3.  Fill in the blanks using the words from the help box.

                                                               false, if, true, else

                        a.  The ____________ statement is the simplest conditional statement.
                        b.  In Python, the non-zero value is interpreted as ____________.
                        c.  Decision statements may give the results true or ____________.

                        d.   The ____________ block will be executed if and only if the provided condition evaluates to false.

                     4.  Short answer type questions.
                        a.  What is decision-making statement?
                             ______________________________________________________________________________

                        b.  Write the syntax for the if…elif…else statement.
                             ______________________________________________________________________________

                        c.  Write the syntax of the if statement.
                             ______________________________________________________________________________
                     5.  Long answer type questions.

                        a.  Draw the flowchart for nested if statement.

                        b.  Write a Python program to convert centimeters to inches. (Hint: 1 inch = 2.54 cms)

                                                                                            fun Zone

                         Let's soLve                                                                  Computational Thinking

                         What will be the output of the following programs?

                       1. a = int ( input ( "Enter a First Number: " ) )
                         b = int ( input ( "Enter a Second Number: " ) )
                         if a > b :
                             print ( "First number is greater than second number " )
                         else :
                             print ( "Second number is greater than first number " )
                        2. num = 3.4
                         if num > 0:
                             print("Positive number")
                         elif num == 0:
                             print(“Zero”)
                         else:
                             print("Negative number")
                        3. x = 31

                         if x > 10:
                           print("Above ten")
                           if x > 20:

                                                                                        Conditional Statements in Python  137

| 134 135 136 137 138 139 140 141 142 143 144 |