The multiplication table trainer realizes random problems, and repeats the execution to control rand

Mondo Science Updated on 2024-02-01

The multiplication table trainer realizes random problems, and repeats the execution to control random variables

This script is not complicated, I have done an addition, subtraction, multiplication and division exercise before, this is a simplified version of the multiplication exercise. After the script runs, the script begins to randomly produce questions, and after the answers, the system gives a judgment, and the correct answer can get points, and the system will automatically broadcast the correct answer if the answer is wrong.

First, let's set up three variables, one for integration and the other two for multiplication. The variables involved in the multiplication operation are tentatively named "a", "b", or other names, and the principle is similar. We need him to be involved in the operation immediately, so we take a random number between 1 and 9.

The focus is on the computation process. What we need to do is to ask for a reply, then judge whether the reply is correct or not, and then make the corresponding command. The difficulty is that these blocks are not together, and you need to find the appropriate blocks from the programming editing area of "operation" and "detection", and then build a script.

After the inquiry block is built, the center of gravity block of this script is completed, and then you can make a judgment. When the answer is wrong, because the correct answer is given, it is necessary to let the variables participate in the operation, so that the number can be randomly reported every time. Finally, add repeats, or limit the number of times. This allows you to practice multiple times. Through the script, we can see that the entire operation process is automatically completed by the programming script through logical relationships.

Of course, the script is poorly done. Whether it is in terms of appearance or script editing, there is still room for optimization. That's for later. Can you still optimize this script?

Related Pages