![]()
Variables are like small boxes inside the computer that store important information for us. Imagine the following situation:
![]()
Variables are like small boxes inside the computer that store important information for us. Imagine the following situation:
Imagine you own a bar that serves the best lemonade in town. The lemonade is stored in a small, non-transparent barrel, so you cannot see how much is left inside.
It is important to always have fresh lemonade available. If it runs out before the next delivery, your customers will be unhappy. If you order too early, the lemonade might not be fresh, and again, customers will not be satisfied.
To solve this problem, you take a piece of paper and write down how much lemonade is left. This piece of paper represents your variable. Every time a customer orders lemonade, you subtract the amount and write down the new value. You repeat this process until you reach, for example, 10 liters - then you order a new barrel.
In this example, the piece of paper is like a variable. It stores important information - the amount of lemonade in the barrel. If we want to program this process, we read the value (from the variable), subtract the amount sold, and store the new value again.
We may not know the exact values in advance, but that is not a problem. We repeat the same steps until the variable becomes less than or equal to 10.
This Tutorial is used in the following courses and lessons
This is the first level of the LEGO Robotics Curriculum with Python, designed for students in grades 4 and up.
In this robot adventure, students learn to control robots using real Python code, while teachers guide them through their first steps in text-based programming. Throughout the level, students build a variety of LEGO SPIKE Prime robot models and program them to move, turn, and complete tasks with increasing precision.
Step by step, students learn how to read, understand, and write their own Python programs. Through fun and creative challenges, they bring their robots to life and discover how code can control movement, solve problems, and interact with the world. Along the way, they explore concepts such as navigation, obstacle avoidance, and sensor-based behavior.
The curriculum is designed to help teachers introduce programming in an engaging and approachable way while giving students plenty of opportunities to experiment, test ideas, and develop confidence in their coding skills.
By the end of the level, students apply everything they have learned in an exciting robotics competition. Using their own programs and robot designs, they complete missions on a competition field with boxes, putting their coding, engineering, and problem-solving skills to the test.
Today, we will build a robot that can automatically clear a landing site.
Sending robots to the Moon is very expensive. Because of this, they are designed to fit into small spaces on spacecraft, rather than being easy to control. Today’s robot is built to simulate this challenge.
Before a spacecraft lands on the Moon, a robot is sent first to clear the landing area. Your robot starts on the Moon, and its task is to prepare the site for the landing of a larger spacecraft.
