Jump to content

Programming language for kids?


Iskaral Pust

Recommended Posts

2 hours ago, Iskaral Pust said:

Thanks kungtotte for good suggestions.  My wife ordered a kids' Python book from Amazon.  I'll check out these too. 

So far I've taught him print, input, if/elif/else, while, for, randint and arrays.  Each time I pick a simple problem or scenario and help him understand how we need to break it into tools and steps.  For practice, we've built an array of mini-games like guessing a random number or dice-based battles from D&D.  Yesterday, for revision on for and if, I asked him to get a program to recite the Happy Birthday song using a for loop and an if/else test.  He was able to write it with minimal help.

Why are arrays so weird in Python?  They are one of the most fundamental data structures.  

Next I'll investigate whether Python has class data structures and allow him to build an extended D&D-type game with various instances of classes "heroes" and "monsters". 

If you want arrays, use NumPy.

Lists, tuples, and sets have nice properties, but aren't good for crunching numbers.

Link to comment
Share on other sites

Yes, I've used lists so far, which are ok for managing groups of data but still a bit weird that you can't just dim the arrays at the outset to ensure consistent sizes.  You need the extra step to establish size/dimension, and the constituent types are inherently fuzzy, and multidimensional looks like a pain in the neck to manage, and they don't allow the kind of matrix math I'm used to from MatLab or APL (both are interpreted languages too), which is really powerful for combining conditional tests within computations.

It's just something to deal with.  I'm surprised that Python, being widely used in the STEM field, has such a loose notion of an appended list as the proxy for a foundational data structure like an array. 

I have not looked at tuples or sets yet.  We're building slowly from the bottom up. 

Now starting him on a more complex text-based game with menus and a variety of player actions.  It's similar to the drug dealer text-based game I saw in the 90's, but this will be kid friendly with a caravan trader in the Crusade-era Levant. This will add functions to his toolkit and involve much more thinking and organization of ideas prior to coding.  

Link to comment
Share on other sites

1 hour ago, Iskaral Pust said:

Yes, I've used lists so far, which are ok for managing groups of data but still a bit weird that you can't just dim the arrays at the outset to ensure consistent sizes.  You need the extra step to establish size/dimension, and the constituent types are inherently fuzzy, and multidimensional looks like a pain in the neck to manage, and they don't allow the kind of matrix math I'm used to from MatLab or APL (both are interpreted languages too), which is really powerful for combining conditional tests within computations.

It's just something to deal with.  I'm surprised that Python, being widely used in the STEM field, has such a loose notion of an appended list as the proxy for a foundational data structure like an array. 

I have not looked at tuples or sets yet.  We're building slowly from the bottom up. 

Now starting him on a more complex text-based game with menus and a variety of player actions.  It's similar to the drug dealer text-based game I saw in the 90's, but this will be kid friendly with a caravan trader in the Crusade-era Levant. This will add functions to his toolkit and involve much more thinking and organization of ideas prior to coding.  

Lists are nice because they are mutable, undefined collections of anything. you can have lists of strings, lists of numbers, lists of lists, lists of sets, lists of dictionaries, or a random mix of all that stuff.

People in STEM fields use the NumPy add on, which has functionality for arrays and matrices.

NumPy is one of hte most used Python packages, and should be included with your python installation.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...