Elementary school math with Kids... using PowerShell

I attended a parent-teacher conference this week in my kids' school. Interesting enough the school now evaluates students' math level with an online services, which claimed to provide real-time feedback to teacher. Needless to say, kids have areas to improve.

I came home that night and decided to play some math games with my kids. I started my saying random numbers and challenged kids to add or subtract those numbers. Like... "Let me challenge you with this question.... 17 + 12?" Soon, I started to repeat numbers and also forgot about the number I just said! 🤦‍♂️

So... I whispered to myself, there is nothing can't be done with a little bit determination and PowerShell. I started off by using the Get-Random to get random numbers between 1 and 30. Then decided to have PowerShell just generate the questions for me.


PS C:\Users\l> Get-Random -Minimum 1 -Maximum 30
7

PS C:\Users\l> Write-Host "$(Get-Random -Minimum 1 -Maximum 30) + $(Get-Random -Minimum 1 -Maximum 30) ="
9 + 23 =


Then my laziness invent-and-simplify spirit kicked in... Well, I feel much more fun when solving the questions with kids, not spending time to make up questions for them. The final result is this PowerShell function: Get-MathQuestion( Link to code on Github) that can produce following:


PS C:\Users\l> Get-MathQuestion -NumberOfQuestion 5 -Diffuculty hard -ShowAnswer
    6780 - 6611 = __________                  Answer: 169
    1846 + 5538 = __________                  Answer: 7384
    7474 - 1285 = __________                  Answer: 6189
    3986 + 4445 = __________                  Answer: 8431
    4708 + 1026 = __________                  Answer: 5734

 With a few more lines of PowerShell for text parsing and Out-Printer, I can now print out worksheets with questions suitable to each kid's level. I can solve those with my kids and still have a good time now. I didn't expect PowerShell is used this way but hey it worked! 😁



Comments

Popular posts from this blog

PowerShell Universal Dashboard and AWS Elastic Beanstalk

Quick review on my career after learning PowerShell

The next chapter... or rather next page. :)