Page 55 - Touhpad Ai
P. 55

Program 3: To demonstrate the use of single line comment

                   # This is a single line comment
                   print("Hello, world!")  # This is another single line comment
                   Output:

                   Hello, world!

                 u  Multiline  comments:  Python does  not  have a built-in syntax  for multiline  comments  like  some  other  languages.
                   However, multiline strings enclosed within triple quotes (‘‘‘ or “””) are often used for this purpose. Although these are
                   technically strings and not comments, they serve the purpose of commenting out multiple lines of code.

                    Program 4: To demonstrate the use of multiline comments

                   '''
                   This program demonstrates basic arithmetic operations without using functions.
                   It performs addition and subtraction of two numbers.
                   '''
                   # Addition
                   a = 10
                   b = 5
                   result_add = a + b
                   print("Addition:", result_add)
                   # Subtraction
                   result_sub = a - b
                   print("Subtraction:", result_sub)
                   Output:
                   Addition: 15

                   Subtraction: 5


                 Character Set

                 In Python, a character set refers to a collection of characters, typically defined by a specific encoding scheme, such as
                 ASCII (American Standard Code for Information Interchange) or Unicode. Each character in a character set is represented
                 by a unique code point.

                 A  programming language’s  character  set  refers to  the  permissible  characters  recognised  by  that  language.  When
                 discussing the Python programming language specifically, its character set encompasses all valid characters allowed for
                 scripting. These include:
                 u  Letters: Both uppercase (A-Z) and lowercase (a-z) letters.
                 u  Digits: All numerical digits from 0 to 9.

                 u  Special Symbols: Python accommodates various special symbols such as single quotes ('...'), double ("...“), semicolons
                   (;), colons (:), exclamation marks(!), tildes (~), at symbols(@), hash signs (#), dollar signs ($), percentage signs (%),
                   caret sign (^), backticks (`), ampersands (&), asterisks (*), parentheses (), underscores(_), plus signs(+), hyphens(-),
                   equal signs(=), curly braces {}, square brackets [], and backslashes(\).
                 u  Whitespace  characters: Python  recognises  whitespace characters  including  tab  spaces,  blank spaces,  newline

                   characters, and carriage return characters.
                 u  Others: Python supports the entirety of ASCII and Unicode characters, comprising the complete Python character set.





                                                                                 Basic Concepts of Artificial Intelligence  53
   50   51   52   53   54   55   56   57   58   59   60