And with all the inactivity around here, I thought that this could create some kind of conversation here.
Anyway, about the script itself, of course I could've done this using JavaScript, but since I'm learning Python I thought I could do it with it instead.
The only kind of math problem currently featured is addition. Later I'll add subtraction and other basic ones. I just need to change the structure a bit because it was designed to only give addition calculations. I'll make it so that it selects randomly from the four/six different mathematical operations and then it would be unpredictable and more challenging. This script uses the Python random module to get the random numbers for the calculations, btw.
Instructions are given after you execute the Python script in the terminal. To execute it in a Linux terminal, enter
python '/yourfilepath/math.py'You can also automatically get the file path if you type "python " and then drag the file into the terminal. For windows, I really don't know, I guess you have to get the full file path to the python.exe file and execute the script with it.
Download the .py file here <-- press CTRL + S after arriving to the page to save. Or go to "File -> Save as".
Any opinions and suggestions are appreciated, but remember that this is my first script with a 'purpose'. And I know the source is kind of a mess, because I made this only for myself and it wasn't intended to go public. And since it's a python script, there is no other choice than open source hehe
TIP: if 3-digit numbers are hard for you, you can open the .py file in a code editor and change the following on lines 17-18:
num1 = random.randrange(0, 101) num2 = random.randrange(0, 101)to:
num1 = random.randrange(0, 50) num2 = random.randrange(0, 50)
This way the results will always be 2-digits or less.
Edited by Baniboy, 29 April 2010 - 08:26 PM.















