Page 65 - Touchcode_C8_Flipbook
P. 65

E.  Answer the following questions:
                     1.  What are arrays in programming?

                         .............................................................................................................................................................

                         .............................................................................................................................................................
                     2.  Explain how arrays are indexed in programming.

                         .............................................................................................................................................................
                         .............................................................................................................................................................

                     3.  How do you search a particular value from an array in Python?
                         .............................................................................................................................................................
                         .............................................................................................................................................................

                     4.  Write any two advantages of array.

                         .............................................................................................................................................................
                         .............................................................................................................................................................



                       Applied Project

                                              To print reverse of an integer number

                  In this task, you will learn to create the program which will print the reverse number of the given
                  number.

                  To perform the task, follow these steps:
                  Step 1:  Visit the link:  https://arcade.makecode.com/. Create a project ‘Reverse  number’, and
                           click on ‘Create’.

                  Step 2:  Create    four    variables    ‘number’,   ‘interNumber’,
                           ‘newnumber’ and ‘storednumber’.

                  Step 3:  From  ‘variables’ select ‘set newnumber to 0’ and ‘set
                           storednumber to 0’  block, and  drop then  to ‘on start’
                           block.
                  Step 4:   Change the value of ‘set newnumber to 0’ to ’2345’ and in
                           ‘set storednumber to 0’ drop a variable ‘newnumber’.

                  Step 5:  From ‘Loops’ select ‘while’ loop and drop it ‘on start’ block.

                  Step 6:  In  ‘false’ of ‘while’ loop, drag and drop the comparison
                           block, and change its sign to ‘>’. In the first ‘0’ of comparison
                           block drag and drop the variable ‘newnumber’.
                  Step 7:  Drag and drop ‘set interNumber to’ and ‘set number to’
                           block inside the ‘while’ loop.


                                                                                     Programming with Arrays     63
   60   61   62   63   64   65   66   67   68   69   70