Tag: practice math

One of my projects this Summer is to create a working version of my Practice Math project. The goal of this project is to create a site that my kids can use to practice their math.

The idea was to create a simple site that would randomly generate math equations that kids could use to practice addition, subtraction, multiplication, and division. To do this, the site would need to have the following functions, at least in the first phase of my project:

Randomly generate two numbers, and a math operator to create an equation;

Evaluate the solution to the equation;

Prompt the child to offer an answer to the equation;

Compare the child’s answer with the actual solution, and give feedback;

Make sure that equations don’t produce negative solutions (our kids haven’t really learned how to work with numbers less than zero); and

Round answers to two decimal places (it can be more than this, I just picked two decimal places for now).

Version 1 – the Javascript Edition

My initial version of the project was based on Javascript. You can find that one here, on GitHub. I wasn’t able to make much progress beyond randomly generating the numbers and math operators that would be used in equations.

I hadn’t worked out how to evaluate the randomly generated numbers, more move much beyond point two in my list of features. I’m certain it’s possible, I just hadn’t worked it out yet.

Version 2 – the Python Edition

I recently decided to return to learning Python. I last attempted to learn Python about a year and a half ago. At the time, I was learning Python 2.7.x. I didn’t move beyond loops at the time.

This time, I decided to start with Python 3.x, which is the current version. I’ve been learning when I have time, and I really like the language. I decided to revisit my Practice Math project and create a Python version to help me learn the language.

Next steps

The next step is to create a web interface for this. A command line version is fine to play around with, but for this to be useful, it needs to be a web site. I haven’t worked out how to add a Javascript front-end to this (I believe it’s possible, I have no idea how to do it, though).

What I’ll rather do, though, is use a Python web framework like Django to create a front end for the site. I’m really keen to learn how to do that, partly because I want to port my Modiin Bus project over to Python too at some point (I discovered that the transit data that I’d like to use is available through Python APIs).

At the same time, I also intend figuring out how to represent fractions in the web interface. I know that’s it’s possible to use Javascript to represent fractions on a web page using options such as math.js and MathJax. I’ll look for equivalent options for Python/Django.

There are also a couple niggling issues about the current version that I’d like to resolve too. These likely exist because I’m still very much a Python newbie.

I’m sure there are other improvements I could make to how the script accepts, and processes input from users. I’ll figure that stuff out as I go. For now, I’m pretty please that this core script seems to be working.