CHAPTER 9: PYTHON – LOOPING AND TKINTER GUI

 

CHAPTER 9: PYTHON – LOOPING AND TKINTER GUI

 D. 1. Differentiate between WHILE - ELSE LOOP and FOR – ELSE LOOP

When we use else with while loop this structure is known as while-else loop. Using this loop, we can run an instruction code when the comparing value reaches to exceed limit of condition value.

When we use else with for loop, this structure is known as for-else loop. The else clause of a loop gets executed only if the loop completes its execution normally without having encountered with break statement.

 2. Differentiate between RADIOBUTTON and CHECKBUTTON.

Radiobutton is used to create one option out of many selections. The user is provided with multiple choices out of which only one can be selected.

Checkbutton is used to create multi-selection check boxes. User can select one or multiple check boxes from the list.

 E.1. What are loops and why are they important in Python?

Loop causes a section of our program to be repeated a certain number of times. Using the loop, the lines of code reduce. It takes less time to type the code which saves overall time and also makes the program error-free.

 2. Define Range().

Range is a pre-defined function of Python. This function is used when we need to perform an action for a specific number of times.

 3. Name three types of Tkinter layout management methods.

The three types of layout management methods of Tkinter are Pack, Grid and Place.

 F.1. Explain for-loop with example.

The for loop is used to repeat a block of statements until there are no item in any sequence. This statement iterates over the items of any sequence, in the order that they appear in the sequence.

Suppose our teacher asks us to read five pages from a book. Here the reading task is repetitive. So here we set this condition in loop, read the book until we reach up to the 5th page. The process of reading would stop when we reach page number 6.

 2. Explain Break statement and Continue statement with example.

Break statement can be used to unconditionally jump out of the loop. It terminates the execution of the loop. We can use it in while loop and for loop.

Continue statement is used to tell the program to skip the rest of the statements of the current iteration of loop block and move to next iteration of the loop. Loop does not terminate but continues on with the next iteration.

 3. What is Widget? Give example.


Widget is a small part of Graphical User Interface which provides better controls for user. A user interacts with GUI using various controls like Label, Entry, Button, Radio Button, etc.

Popular posts from this blog

CHAPTER 8: APP DEVELOPMENT

CHAPTER 5: OPENSHOT VIDEO EDITOR