Activity 1: Navigating Decisions with If-Else-Elif Statements
Teaching students the fundamentals of if-else-elif statements through hands-on activities.
Grade: 5
Time: 1 Hour
Description
In this activity, students will learn the fundamentals of if-else-if else (elif)
statements through a hands-on lesson involving a model car and a programmable robot (GoPiGo). Students will explore decision-making using block code processes by programming the robot to navigate a multi-way road with a barricade, simulating real-life scenarios where alternate routes must be taken when the primary route is blocked.
Materials Required
- Model car
- Two-/three-way road setup. Picture of demo map is shown below.
- Barricade (mini yellow cones)
- GoPiGo robot
- Laptop configured for GoPiGo
Steps to Conduct the Activity
Step 1: Topic Explanation
- Use simple examples to illustrate the concept of if-else statements, such as deciding whether to bring an umbrella based on whether it is raining.
Step 2: Explain the Problem
- Show the students a model car on a three-way road. Place a barricade on one of the roads, explaining that the primary route is blocked due to construction.
- Illustrate how and why the car needs to decide to take an alternative route if the primary route is blocked.
- Block another route, and ask students what they would do now since two main routes are blocked.
Step 3: Interactive Time
- Ask students what they would do if they were in this situation. Would they take the other route? How would they do it? Are there any other options they would prefer?
- Divide the class into two groups, each group with a laptop under supervision.
- Using block code, guide each group to set up their robot (which will serve as the car) to reenact the two situations.
- Allow the students to test their code by running the robot on the road setup.
Reflection
- Bring the groups together to discuss their experiences. Ask each group to share their challenges and solutions.
Learning Outcomes
By the end of this activity, students should be able to:
- Comprehend the basic structure and function of
if-else-elif
statements in programming. - Use conditional statements to create decision-making processes in block coding.
- Simulate real-life problem-solving by programming a robot to navigate alternate routes when the primary path is blocked.
- Enhance their computational thinking skills by breaking down a problem into smaller, manageable conditions and actions.
- Test their block code in a practical setup and debug any issues that arise to ensure the robot navigates correctly.