Page 78 - Code Craft Computer-8
P. 78

On running the program, we get the following output:




























                      Try It Out                                                                   #Critical Thinking


              Write a program in Python to find the power of a number.
















            THE WHILE STATEMENT
            The while statement executes a set of statements repeatedly, until the logical expression evaluates
            to true. When the condition becomes false, the control comes out of the loop. The syntax of while

            statement is given below.
            Syntax:
            while (test expression) :

            Statements

            Program 7: To demonstrate the use of a while loop.



















                                                                 78
   73   74   75   76   77   78   79   80   81   82   83