Page 113 - ThinkGPT_V2.1_C6_Flipbook
P. 113

Information Literacy
                       code Quest                                                     Technology Literacy


                      Guess my name.
                      1.  I am a free and open-source programming language.
                      2.   I am a command line shell which gives immediate result for
                          each command.
                      3.  I save the commands entered by the user in the form of a program.





                 Variables in Python

                 Variables are memory reference points where we store values that can be accessed or changed
                 later. The names given to the variables are known as identifiers. In Python, we do not need to
                 specify the type of variable because Python is a dynamically typed language and it identifies the
                 variable type automatically.

                 Declaring and Initializing a Variable

                 In Python, variables are declared and initialized at the same time in the following way:
                    a = 10                                           Output:
                    b = 20
                                                                     a=10
                    print ("a=", a)
                    print ("b=", b)                                  b=20
                 You can also assign the same value to multiple variables at the time in the following way:
                    a = b = 20                                       Output:
                    print ("a=", a)
                                                                     a=20
                    print ("b=", b)
                                                                     b=20


                                                                                      Introduction to Python  111
   108   109   110   111   112   113   114   115   116   117   118