8. Problem Solving
A Flowchart is a diagram that graphically represents the flow of steps in a process or the sequence of steps and decisions for executing a solution to a problem. The children will learn how to design the flow chart by given a problem. It breaks big ideas into small, bite-sized pieces that are expressed visually.
It is convenient to observe and follow the process from beginning to end with the flow chart in a coding problem solving project. The practice of developing a flow chart before the implementation helps to highlight the key elements and detach not essential or even excessive steps.
Some things are either true or false (specifying this formally is called “propositional logic”). It is important to identify common ways of thinking to guide us to make decisions so that you can sharpen your own logical analysis. Otherwise, fallacy lies in that you are distracted from true premises and led to assume something faulty. The learners will learn from real-life examples. These examples help them to develop the coding skills and knowledge to make decision.
Logical operators are mainly used to control program flow. Usually, you will find them as part of an “IF”, a “WHILE”, an “AND” or some other control statement. They allow a program to make a decision based on multiple conditions. Each operand is considered a condition that can be evaluated to a true or false value.
Coding with Logical Operators
IF & WHILE
An “IF” statement checks if an expression is true or false, and then runs the code inside the statement only if it is true. The code inside the loop is only run once. A “WHILE” statement is a loop. Basically, it continues to execute the code in the while statement for however long the expression is true.
AND, OR & NOT
AND connects two conditions and returns true only if both conditions are true. OR connects two conditions and returns true if either condition is true or if both conditions are true. NOT doesn’t connect two conditions. Instead, it negates (reverses) a single condition.
If the expression evaluates to True then the statement following the then keyword is executed.
If the expression evaluates to False, then the statement following the else keyword is executed, if it is present.