Make Your Own Addition Bot Using Python

Addition Bot
Facebook
Twitter
LinkedIn
Reddit

Addition Bot

Once upon a time in the colorful world, there lived two adventurous friends, Beetle and Tobi. They were always curious about everything around them, especially math. One sunny morning, while exploring, His friend Tobi approached the friendly bot, Bot explained that he was an Addition Bot, designed to make math fun and easy for everyone. He could solve additional problems and he loved helping kids understand the magic of numbers. 

Beetle was very Excited to learn more about the addition that Tobi learned from the Bot, Tobi took out two colorful apples from his bag and said, “Let’s start with something simple. If we have two apples here, and we add three more apples to them, how many apples will there be in total?”

Beetle thought carefully and said, “Hmm… If we count 1, 2, 3, 4, 5 apples!”

Apple

“Great job, Beetle!” Tobi praised. “When we add three apples to the two apples we already have, we get five apples in total.”

Hey Beetle, Let’s see the code I have learned from Addition Bot-

Make Your Own Addition Bot Using Python

Select Sprites- 

1. In this, you will take Beetle as a sprite1. Make a duplicate of the Beetle sprite to give an Animation Effect

beetle2. Select Arrow and Rotate the legs as given in the picture.

beetle sprite duplicate

3. Select Another Sprite, Tobi

4. Select Another Sprite, Tobi

Tobi
Tobi

 

Make a conversation between sprites-

5. Two sprite objects, t and be, you will create. Name them as ‘Tobi’ and ‘Beetle’, respectively.

6. import time: The time module is imported, which allows for the use of time-related functions, like time.sleep().

7. The gotoxy() method is used to position the sprites on a graphical screen.

8. The say() method is used to display a speech bubble above the ‘Tobi’ sprite with the given message. The number 4 represents how long the speech bubble will be displayed (in this case, 4 seconds).

9. for i in range(10): This starts a for loop that will repeat the following code 10 times.

Taking Inputs with Sprite-

Now Tobi will test the Addition Bot, it’s very important to take the inputs from the user. For that there are 2 important functions we will use:

  • input(): This function makes the sprite ask the question to the user.
  • answer(): This function stores the value entered by the user.

10. Then, for inputting the numbers from the user we will make use of the input function, this function would create an input box on the stage where you can enter your number and then press ENTER.

11. We will also make use of answer() function which will return the most recent text inputted with the input() function. Here the type of answer() function is being mentioned as int, which means it will return an integer value.

int(sprite.answer())

12. Now we will assign the output of each answer() function to a unique variable 

13. Finally, we will assign the sum variable as a + b.

Output-

Beetle was delighted with Tobi’s friendly and interactive way of teaching. They continued to explore the world of addition together, trying out various combinations of numbers. They learned that addition was like putting things together to find the total.

As the day went on, Beetle and Tobi became even more fascinated with math. They practiced adding numbers with the help of the Addition Bot until they were experts at it.

 They inspire everyone around them to embrace the magic of math and the joy of learning together. 

Facebook
Twitter
LinkedIn
Reddit