Lambda function to calculate squares and cubes
Provide a basic calculation of any integer's square and cube values upon request to an Alexa skill.
Zoey attends a Montessori school where she has gravitated toward the math based activities. At just over five years old she's astounded her teachers as well as her mother and I as she's sailed through mathematics work into something that I find endlessly interesting - long chains.
As Zoey persisted in her requests for me to help her learn to code, we started with Hello World
in the Python REPL. She found this fascinating and inquired as to what else we could code - so I took the opportunity to work with her in automation in her passion for mathematics.
Ever curious, Zoey asked what else we could code, so we moved on to showing how Python could replicate calculating the length of long chains (cubes) in the REPL.
> 3 * 3 * 3
27
After learning how to do this, I introduced basic variables and functions. Zoey astutely asked why one would use a variable and write a function. As I was lost for a decent #eili5
explanation, I used an example of reuse I knew with which she could identify - asking her Alexa.
As one of the advanced mathematics activities in Zoey's school day involves counting long chains. These are build upon previous counting skills where colored beads allow them to count by each integer between one and ten.
A short chain is one segment of one, two segments of two, etc up to nine segments of nine and ten segments of ten - in other words visually teaching how to square an integer.
A long chain is simply the next level, teaching the cube of each integer with three three-segments showing that three nine squares yield 27.
Her personal pride and enthusiasm in this activity is amazing and she's asked many times to have me help her learn to code. Hence, this project.
Zoey is a huge fan of her Alexa dot, routinely using it to play music for play or sleep.
As a software engineer and after years of provisioning and managing servers; I've become obsessed with serverless technology. With the extremely low cost, I suggested that we work together to take her code and use it to teach Alexa to calculate the length of a long chain.
It's a fun activity to share and fun way to start #NoServerNovember
.