Page 108 - TrackpadV5.1_class8
P. 108

c.  How does the continue statement differ from the break statement in loops?
                         ______________________________________________________________________________
                         ______________________________________________________________________________

                         ______________________________________________________________________________

                      d.  Write the syntax of the following:

                         (i)  while Loop
                         ______________________________________________________________________________
                         ______________________________________________________________________________

                         (ii)  for loop
                         ______________________________________________________________________________

                         ______________________________________________________________________________
                      e.  What are jump statements?

                         ______________________________________________________________________________
                         ______________________________________________________________________________

                         ______________________________________________________________________________

                  5.  Write the output of the given Python Code:
                      a.  x = 15

                        y = 20

                        if x > y:

                            print("x is greater than y")
                        else:

                            print("y is greater than or equal to x")
                         ______________________________________________________________________________

                      b.  total = 0

                        for i in range(1, 11):
                            total += i

                        print("The sum of the first 10 natural numbers is:", total)
                         ______________________________________________________________________________
                      c.  x = 10

                        while x > 0:

                            print(x)
                            x -= 2
                         ______________________________________________________________________________






                  106   Pro (V5.1)-VIII
   103   104   105   106   107   108   109   110   111   112   113