

Dot operator and importing commands
Have you noticed how the "start_at_power()" command is written after the "MotorPair()" command and they are separated by a dot? This dot separation is called a "Dot" operator.
- #1659
- 20 Aug 2020
Have you noticed how the "start_at_power()" command is written after the "MotorPair()" command and they are separated by a dot? This dot separation is called a "Dot" operator.
We have already experimented with the program that makes the robot move forward. But what exactly makes it move and by how much?
Seeing a Python code for the first time can seem a bit scary, especially if you have only programmed with blocks before. This tutorial explains the initial code in the LEGO SPIKE project briefly, as well as what it does.
In our very first program, we will use 2 commands that make the robot move forward for 2 seconds.
After connecting to the hub and uploading the program, this is the final step in seeing our robot come to life. This tutorial explains the SPIKE hub's minimalistic menu and how to navigate it in order to start a program.
This tutorial outlines the two ways to upload programs to the SPIKE hub and which one is preferred.
Here follow the process of planning and publishing the groups online on the website.
When we write code, it's crystal clear to us what it does, but this won't be the case in a few months when we might have to change it again.
This is why it's good practice to place comments in the code where we explain what different parts of the code do.
Here are the conditions your robot is evaluated under in order to qualify as a good solid construction.
You should already be acquainted with creating numeric variables, how to set their initial value, and how you can use them, but the main function of the variable is that it varies.
Here, we'll show you how you can change the value of numeric variables using two different syntaxes.
You should already know how your program can make a decision based on a given condition, but sometimes, the decisions it has to make require more than one condition.
This can be done in several ways and we will look at how to do it using logical operators.
Today's lesson has no new material to teach the students. Instead, the students should revise and solidify their knowledge and you should focus on those students that are falling behind.
Try your best to teach them agency so that they do not fall behind again.
At the end of the lesson, direct all of the students to the last of the additional tasks.
Python requires the code to be ordered in a strictly specific manner in order to work properly and as you can imagine, this becomes complicated when we start nesting operators inside one another.
Here, we will show sine things you should look out for when writing code and some good practices for evading some common mistakes.
We know the code that is dependant on operators must be indented forward, but if we decide to place 100 lines of code in an operator after it has already been written out, the indenting of each line of code separately would be a painfully lengthy process.
The "wait()" command is useful if we wish the robot to wait for a specific amount of time, but if we wish for our robot to wait until a given condition is met, we need to be a bit more inventive.