Python Open Lab October 19

This week we mainly learned about condition statements.
First we learned how to read user-input from console by using function input(). Input() can introduce user input to our program so user can define some values and program can get that.
Then we looked at the definition of condition statement, which means when condition is met, code will be executed, otherwise the next statement will be executed. ‘If’ statement is introduced first. If the condition of the ‘if’ statement is satisfied, code in the ‘if’ structure is executed. ‘else’ statement can appear below the ‘if’ statement. When the condition of ‘if’ statement is not met, condition ‘else’ statement is stratified naturally.  ‘elif’ statement is to help program decide on different conditions. It is similar to ‘else’ statement but we can write conditions in the ‘elif’ statement. The structure is like this:

                        if <some condition>:
                               do A
                        elif <some condition>:
                               do B
                        else:
                               do C

We learned how to apply ‘if-elif-else’ statement in the loop to do more complicated task.  Then we got an idea about what is ‘continue’ and ‘break’ statements. ‘continue’ skips the rest code of present iteration in the loop. ‘break’ jumps out of the present loop(end it). Nested loop is introduced for students to have a better understanding of ‘continue’ and ‘break’ statements.