Page 93 - Code_GPT_Class_8
P. 93

Topic Flashback                                                     21 st  Century
                                                                                                 Skills  #Critical Thinking

                       Write the result for the following conditions:
                         day ="Sunday"                                    height_inch=46
                         IF day = "Saturday" OR day= "Sunday"             ticket ="no"
                         THEN
                                                                          IF height_inch > 40 AND ticket = "yes" THEN
                              PRINT "It's a holiday"                           PRINT "Entry allowed"

                         ELSE
                                                                          ELSE
                              PRINT "It's not a holiday"
                                                                               PRINT "Entry not allowed"









                          Interdisciplinary Learning                                                    Lab Activity


                    Write a program to check whether a student has passed or failed.
                    The conditions for declaring a student as passed or failed are listed below:
                    For, percentage >= 40 : Pass
                    For, percentage < 40 : Fail




                 LOOPS IN A PROGRAM


                 A loop allows a set of instructions or a block of code to be executed repeatedly. It helps in automating
                 repetitive tasks and makes the code more efficient by avoiding the need to write the same instructions
                 multiple times. When a loop repeats forever (endlessly), it is called an infinite loop. There are two types
                 of loops.

                     Counting loops: These repeat a block of code a certain number of times.

                     Conditional loops: These repeat until a certain condition is reached, which means they keep going
                    until the condition remains true.
                 For example:
                 Robby has to paint these blank boxes to make a letter ‘U’
                                      Start                               Start



















                                                                                          Algorithmic Intelligence  91
   88   89   90   91   92   93   94   95   96   97   98