I made a fun coding project called “Stop at Five.”
In this project, when you shake the device, it generates a random number between 1 and 10 using the import random function in Python. The goal is to get the number five. If the number that appears is less than five, the display shows “Too Low.” If it’s greater than five, it shows “Too High.” But if you’re lucky enough to get exactly five, it says “Bingo!”
I used if, elif, and else statements to compare the random number to five. These are called comparison operators, and they help the program make decisions. The accelerometer detects when the Micro:bit is shaken, which triggers the random number generation. I really enjoyed watching how the code responds differently each time — it makes the project feel like a mini guessing game!
Through this project, I learned how to use Python’s random module, work with if-else logic, and understand how sensors like the accelerometer can be used to start actions in code. It was both fun and educational to build.
I liked how simple yet exciting the game turned out. “Stop at Five” teaches how randomness and coding logic work together — and it’s a fun challenge to see if you can get Bingo!