Page 274 - Ai_C10_Flipbook
P. 274

[1]:   # This creates variables for storing marks
                      english=93
                      maths=92
                      # Calculating the programs
                      c=(english+maths)/2

              Multiline Comments

              When writing multi-line comments, we begin the comment with three single quotes ''' or three double quotes
              """, followed by the comment text spread across multiple lines. The comment ends with the same three single
              or double quotes ''' or """.

               [1]:   """This program calculates
                          the average of marks of
                          two subjects of a student"""
                      eng=91
                      maths=93
                      c=(eng+maths)/2
              Keywords


              Keywords have special meaning which are reserved by Python for special purposes and are not allowed to be
              used as identifiers. They are case sensitive. We can see the list of the reserved keywords by giving the following
              command at the Python command prompt:
                  import keyword
                  keyword.kwlist
              Following is the list of keywords displayed by giving the above commands:

                    False                class                finally              is                   return
                    None                 continue             for                  lambda               try

                    True                 def                  from                 nonlocal             while
                    and                  del                  global               not                  with
                    as                   elif                 if                   or                   yield

                    assert               else                 import               pass                 async
                    await                break                except               in                   raise

              Identifiers

              Identifiers are the user-defined names of variables, lists, classes, functions, dictionaries, tuples, etc., which are
              used to identify an element in Python.

              Naming the identifiers follows rules as given below:
                 • An identifier can have letters in uppercase or lowercase, numbers or underscore(_).

                 • It can start with an alphabet or an underscore.
                 • No special characters like $, period(.), space, etc. are allowed.
                 • It should not be a Python keyword.

                 • They are case sensitive. Uppercase and lowercase letters are different.
                 • Identifiers can be of any length.

                    272     Artificial Intelligence Play (Ver 1.0)-X
   269   270   271   272   273   274   275   276   277   278   279