Page 30 - Touchcode_C6_Flipbook
P. 30

The scope or accessibility of the variables defined in a program depends where you have
                  declared it in each program. Variable defined outside the scope cannot be accessed.

                  NAMING VARIABLES
                  Every variable in a program is unique and you need to allocate

                  variable a unique name. You cannot use the same name of a
                  variable more than once.

                  Variable name acts as an  identifier  for that variable and
                  suggest the information which it contains.

                                           Coding fact


                    In Covid-19  pandemic time, Avi Schiffmann,  a teenager,  coded one of the most visited
                    website across the globe ' ncov2019.live', to monitor COVID-19.




                                                                                                       Subject Enrichment
                    Example 1: If variable 'x' stores value 3, variable 'y' stores value 3. When
                    we perform addition operation on 'x' and 'y', we will get the output as '6'.


                  START
                         SET x = 3
                         SET y = 3
                         SET result = x + y
                         DISPLAY "The sum of x and y is: ", result
                  END
                  Output: The sum of x and y is: 6

                  Note: Variable is created, when you assign a value to it.

                  Rules for naming a variable in python:
                      Name your variables in such a way that it describes its purpose.
                     Variable name must begin with a letter or an underscore and can range from 1 to 255 characters.

                      No special character or spaces are allowed.
                      Uppercase and lowercase characters are distinct.
                      Keywords (reserved words) cannot be used as a variable.


                                           Coding fact

                    Co-founders of Apple, Steve Jobs and Steve Wozniak, in their teenage began their coding
                    careers.





                   28     Touchcode-VI
   25   26   27   28   29   30   31   32   33   34   35