Page 64 - Computer - 6
P. 64

Pick Random Block
          The Pick  random                   block,  under  the  Operators  category,  picks  a  number  between  the
          specified range randomly. For example, the pick random 20 to 50 block will randomly pick a number
          from 20 to 50. This block is a reporter block.
          The Operators blocks are used together with the condition blocks in the Control category to create
          interactive projects.


                   Try This
                                                                                                   Computational Skills

             Write the value of the following expressions taking the values of X, Y, and Z equal to 45, 20, and 15.
             1. X mod Y                  ___________           2.  X / Y                    ___________
             3. X > Y AND Y > Z          ___________           4.  X < Y OR X > Z           ___________
             5. Y mod Z                  ___________           6.  NOT (X = Y)              ___________
             7. X / Z                    ___________           8.  X > Z AND Z > Y          ___________


            Lab Activity 3                                                                         Experiential Learning
           Let  us  create  two  variables  Length  and  Breadth  and  accept
           their values from the user. If the length and breadth are equal,
           the sprite says so and draws a square, else it draws a rectangle
           with the values input by the user.
            1.  Create a new project.
            2.  Add the Pen blocks.
            3.  In the Sprite Info pane, type 50 in the Size box to reduce
                the size of the Cat sprite.
            4.  In  the  Variables  blocks  palette,  create  two  variables  –
                Length and Breadth, and hide them.
            5.  In the Scripts area, create the stack of blocks as shown in
                the image.
            6.  Click the Go     button to execute the project.
                 The sample images for the project are given below.




























               62
   59   60   61   62   63   64   65   66   67   68   69