Thursday, June 30, 2016

Coin flipping cat

One good way to start a programming project is to show students what you want them to build, then have them spend some time brainstorming and pseudo-coding before they even open their Chromebooks.

In this case, I will show them the coin flipping cat video,then lead a brainstorming session about how this program can be designed.  If the students are working in pairs or small groups, they can pseudo-code and brainstorm for 10 minutes and then we can spend 5 minutes sharing ideas.


My version of the code.

Wednesday, June 29, 2016

Atari Basic

When I was a kid, my dad got an Atari 800 and taught me BASIC programming.

First of all, I just saw online that an Atari 800 cost about $1,000 in 1980 which, at the time, was a shit-ton of money, especially for a computer that had (a max) of 48K of RAM and a 1.8 Mhz processor.  I remember that when we first got it, we could only load programs from a cassette tape. You could hear the program being loaded.  It screeched rapid fire morse-code through the TV speaker (there were no monitors), and it took about 90 seconds to load a program.  Later on, we got a 5 1/4" disk drive.  I forget what the disk capacity was then.....

Anyway, BASIC. Beginners All-purpose Symbolic Instruction Code. BASIC was perfect for a kid. It was so forgiving of bad programming.  First of all, you had to hit "return" after every line of code and it immediately told you when you used the wrong syntax. So, if you accidentally typed "prunt", you knew it immediately.

Also, Atari BASIC let you use the GOTO statement, which forgave a multitude of programming sins.  As a child programmer, the idea of a program being a logical group of individual subroutines just didn't click with me.  Most of my programming was a collection of "oh yeahs" and "oh waits."  GOTO allowed me to hop all over the place....all I had to do was type in GOTO 50 and the program hopped to line 50.  I could have the program jump from line 20 to line 200 and back to line 20, and as a result, I created programs that that were spastic and squirrely.  


   
When I returned to programming in college, I discovered that GOTO statements were no longer a part of the programming vernacular.  When I was a Freshman, my old Computer Science teacher, who freely smoked cigarettes in his office (he had tenure) and wore a black turtleneck like a yellow, crusty Steve Jobs, yelled at me for asking how to "GOTO" line 80.

My 17 year old son has my old Atari 800 and he loves playing Star Raiders .  I need to Hyperwarp my way over to Ebay and find another one and show it to my students....they will either be blown away by it or  extremely non-impressed.  I'm guessing the former. 

Tuesday, June 28, 2016

Word Scramble with Python

Something that 6th graders will enjoy and will be successful at coding.  The code is clunky but it's a good opportunity for kids to find ways to improve it.

As always, provide an entry point for the kids to start creating the program, and then help them as they run into problems.

A lot of "education experts" have been parroting the mantra that struggle is good.  That's been the big fad in education for the last couple of years, as if it was an astonishing discovery that you want kids to be able to work hard at something without giving up.  Yeah, struggle and perseverance is good, but every kid has a different tolerance level for how much struggle he/she is willing to deal with.  The best a teacher can do is figure out a kid's "zone of willingness to struggle," and then stretch that zone a little bit each day.

I've seen kids spend hours trying to fix a problem with a program.  I've seen other kids quit within a minute of encountering a problem.  I didn't instill those qualities in my students and I have no clue what made them that way.  Maybe it's their parents.  Maybe it's their genes.  Maybe it's the coffee they drink.

If  I am working with a quit-in-a-minute student, I can ask a good question and then push him to go 2 or 3 more minutes. That's an improvement.  At least he's not a quit-in-a-minute student anymore.  Ultimately, though, every student needs to experience some level of success in a coding class, so I need to make sure every kid is making progress, even if I have to give him an answer. Struggle without success, for many kids, is a guarantee that they will never pursue coding (or math) at any level.


Monday, June 27, 2016

Fibonacci AND functions

This was posted on the Python website, a cool little program to generate the first numbers of the Fibonacci Series.   So, with a simple 7 or 8  lines of code, you can teach kids how to define functions and teach them about the Series!


Sunday, June 26, 2016

Python Carrot Puzzle

I recently discovered that '^' does not mean 'to the power of' in Python.  I discovered this in quite a painful way while coding in a library. Librarians don't like it when you start yelling at your computer.  They get aggressive.  They get mean.  Some of them know Jujitsu.

It turns out that 3^2 is not 9.            3**2 is 9.

3^2 is 1.  That seems easy.  3-2=1.  

Well, 3^8 is 11.  Oh...so 3+8=11. 


*%*$!!     3^6 is 5!!!!!!!


Look at the pattern below.  What do you see?


Friday, June 24, 2016

Binary to base 10

This Scratch program would be extremely easy to teach to middle school students....except....for some reason, the developers of Scratch never included a general exponent operator block.  A simple x^y would have sufficed.  Instead, they only offer 10^x and e^x .

Scratchers have complained about this for years, but nothing has changed. 

So, a simple "turn a binary number into a base-10 number" program, which any 6th grader could write and understand, gets kind of complicated because the programmer needs to convert base 10 to base 2, which is easy for Algebra 2 students who knows logs, but not for 6th graders who barely have their heads wrapped around exponents.

Oh well. This will be a good opportunity to let the kids do some Python programming.  The scratch version is shared.


Thursday, June 23, 2016

Binary

There is no better "beginning of the year" lesson for 6th graders than a binary number lesson.

It gets students adding and multiplying (and enjoying it), it makes them feel smart, and it opens their brains to a whole different way of looking at numbers.  It also gives them a fundamental understanding about computers....for now (until Quantum computing becomes a reality), computers are just a complex system of on and off switches represented as ones and zeros.

Once you've shown them a base two system, have them compare it to our base ten system.  Have them identify the advantages and disadvantages of each.

THEN....expand out to the Aztec system (base 20) and the hexadecimal system (base 16).  Fun stuff! 

Oh...and no...9 times F is not "fleventy five."