Page 274 - Ai_V1.0_Class9
P. 274

29.  Why you use the "<" operator?
                Ans.  The "<" operator checks if the value of the left operand is less than the value of the right operand, if yes then condition
                    becomes true.
                 30.  Write syntax for the "greater than or equal to" operator.

                Ans.  a>= b.
                 31.  Is "<" an Assignment operator?
                Ans.  No,"<" is not an assignment operator. As, it is a relational operator.
                 32.  Optimise these statements as a Python programmer.
                     a. word 'word'
                     b. print word. len()
                Ans.  a. word = 'word'

                     b. print len(word)
                 33.  How many types of operations are supported by the Python language?
                Ans.  Python language supports the following types of operations.
                    a.  Arithmetic operations                          b  Comparison (i.e., Relational) operations
                    c.  Assignment operations                          d.  Logical operations
                    e.  Bitwise operations                             f.  Membership operations
                    g.  Identity operations

                 34.  Why do you use the 'break' statement?
                Ans.  The 'break' statement can be used to terminate the loop.

                 35.  Write the syntax of an 'if' statement in Python programming language.
                Ans.  The syntax of an 'if' statement in Python programming language is:
                    if (condition):
                        Statements
                 36.  Write the syntax of an if.....else statement in Python programming language.

                Ans.  The syntax of an if.....else statement in Python programming language is:
                    if (condition):
                        Statements for True
                    else:
                        Statements for False
                 37.  Define while loop.
                Ans.  A while loop statement in Python programming language repeatedly executes a target statement as long as a given
                    condition is true.
                 38.  Write the syntax of a while loop.

                Ans.  The syntax of a while loop in Python programming language is:
                     while <condition>
                         Statements
                 39.  What happens when the condition of the while loop becomes false?
                Ans.  When the condition becomes false, program control passes to the line immediately following the loop.
                 40.  How can a programmer take user input in Python?
                Ans.  A programmer can take user input in Python using the input() function.

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