CHAPTER 9: PYTHON - CONDITIONAL CONTROL STRUCTURES AND TURTLE

        PYTHON - CONDITIONAL CONTROL STRUCTURES AND TURTLE

D. Define The following

1. Assignment operator:

These operators are used to assign value to the variables.

 2. Logical operator:

These operators perform Logical AND, Logical OR and Logical NOT operations.

 E. Differentiate between the following: Simple Statement : Expression Statement

A simple statement lies entirely within a logical line. We do not need to place more than one statement on a single logical line with a semicolon (;) as the separator. Python recommends one statement per line to make programs more readable.

Expression is a combination of variables, values and operators. It is a type of instruction that combines values and operators and evaluates down to a single value.

 F. 1. What is indentation?

Indentation is used to structure Python programs. Code blocks in Python are defined by their indentation. All the statements in conditional and looping statements are structured using indentation.

 2. What do you mean by Control Structures?

In some situations, we have to change the order of execution of the program based on conditions or repetition of statements until conditions are met. Therefore, control structures are used to control or change the flow of execution.

 3. Why do we use if-elif-else statement?

When multipath decisions are involved, we can put ifs together. A multipath decision is a chain of ifs in which the statement associated with each else is an if or elif.

 G. 1. What is if-else statement? Write its syntax.

The if...else statement is an extension of the simple if statement. The if statement will check the condition. if the condition is True, the if block statement is executed, if the condition is False then it executes else block statement.

Its syntax is:

                if condition:

                                Body of if

                else:

                                Body of else

 2. Define Turtle and its associated motion function

Turtle is a pre-installed library of Python which is used to create shapes in attractive manner. It helps students understand the world of programming in fun and interactive way.

The Turtle works with movement and direction.  The associated motion functions of turtle are Forward, Backward, Left and Right


Popular posts from this blog

CHAPTER 3 - ANIMATE - LAYERS AND ANIMATION

CHAPTER 2 - COMPUTER VIRUS