MoonCampaign by Raunak (7 years)
Magic 8-Ball
Raunak
Show and Tell
Show n Tell
Coming Soon
Raunak introduced his Magic 8-Ball project, coded using MicroPython on the micro:bit. He explained the concept of the Magic 8-Ball as a device that answers yes/no questions randomly. His program uses button press input to generate a random number between 1 and 4 to decide the answer. The code includes conditional statements to display responses like "Yes," "No," "Not at all," or "Sure." Raunak emphasized the importance of randomness by using the random.randint function and proper syntax for button inputs and conditional checks. He acknowledged the usefulness of an else statement to avoid errors. His clear explanation showcased understanding of basic programming logic.
Raunak stood before the camera, a little shy but excited. “Hi, my name is Raunak, and my favorite color is blue,” he began. “Today, I’ll show you how I made a Magic 8-Ball using micro:bit and Python.”
He explained the Magic 8-Ball as a fun toy that answers yes or no questions at random. “You ask it a question, then it tells you something like yes, no, or maybe,” Raunak said with a smile.
Raunak shared his screen to show the program. “First, I made the micro:bit listen for a button press,” he explained. “When you press it, the program uses random.randint(1, 4) to pick a number from one to four.” He carefully described how each number corresponds to a different answer: if it’s 1, the micro:bit scrolls ‘Yes’; if 2, it shows ‘No’; if 3, ‘Not at all’; and if 4, ‘Sure.’
He stressed the importance of syntax. “You have to put the quotes and parentheses exactly right for it to work,” he said. Raunak also mentioned using the else statement at the end “to catch anything unexpected and avoid errors.”
With a quick demo, he pressed the button. The micro:bit displayed an answer randomly, just like a real Magic 8-Ball. “It’s cool because every time you press the button, it’s something new!”
His teacher and classmates enjoyed his clear, step-by-step explanation. Raunak’s project showed how simple code and randomness can create a playful, interactive experience. Proud of his work, Raunak encouraged everyone to keep coding and learning.
©️ Copyright, Moonpreneur Inc.
3031 Tisch Way, 110 Plaza West PMB # 138, San Jose, CA 95128, USA
Likes
Rating
49 days left
Magic 8-Ball