Page 285 - AI Ver 1.0 Class 9
P. 285

Task                                                                      Experiential Learning



                 Colab—a free Jupyter notebook environment that runs entirely in the cloud allows you to write and
                 execute Python code. Type http://colab.research.google.com to create your online Python notebooks
                 which can be simultaneously edited by the members with whom you have shared your code in Colab.
                 This process is similar to the way you edit documents in Google Docs, Google Sheets or Google Slides.




                    Python Character Set


            A character set can be a set of valid characters. For example,
               • Digit like 0, 1, 2, …. 9
               • Letters in upper or lowercase like A to Z or a to z
               • Special symbols like $, %, ^, &, *, (), @, !, etc.
               • Whitespaces like spacebar, Tab key or Enter key

               • ASCII or UNICODE characters like emoji symbols or other symbols with unique code.

                    Statements in Python


            Instructions written in a source code that are executed by a Python interpreter are called statements. There are
            three types of statements in Python which are simple statements, multiline statements and multiple statements.
            Let us learn about them in detail.

            Simple Statements

            By default, the end of a statement is done by pressing an Enter key. Each statement is written on a new line.
               a=5 is a simple statement where variable 'a' is created with value 5.

               c=a + b

            Multiline Statements

            We can make a statement that extends over multiple lines by using line continuation character (\) as shown
            below:

               a = 4 + 5 +\
                         6 + 7 +\

                         8 + 9
            The main advantage of using multiline is when we need to do long calculations and cannot fit these statements
            into one line.


            Multiple Statements
            Multiple statements represent more than one statement in a single line. This can be done by separating the
            statements using semicolon (;).
               a = 5; b = 10; c = a + b; print(c)



                                                                                Introduction to Python  283
   280   281   282   283   284   285   286   287   288   289   290