Page 228 - Ai_V1.0_Class9
P. 228

• 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 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.  There  are  number  of  ways  of  making  multiline
              statement. Few are given below:
              1.  a = 4 + 5 +\
                           6 + 7 +\
                           8 + 9

                 \backslash helps you fit long calculations on multiple lines.
              2.  flowers =['Rose','Lily',
                          'Sunflower','Hebiscus']

              3.  marks =(10,25,16,
                          18,28,30)

              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)


                       Tokens

              Tokens are the smallest meaningful unit of a program. Python supports the following tokens:

              •  Keywords            •  Identifiers        •  Literals            •  Punctuators         •  Operators
              Let us discuss each of these in detail.

              Keywords

              Keywords in Python are predefined and reserved words with special meanings and purposes and are not allowed
              to be used as identifiers. We can see the list of the reserved keywords by giving the following command at the
              Python command prompt:

                   >>>import keyword
                   >>>keyword.kwlist
                    226     Artificial Intelligence Play (Ver 1.0)-IX
   223   224   225   226   227   228   229   230   231   232   233