Back to Python (and C#)!

Simon was preoccupied with vector functions for most of the day on Saturday, compiling what, at first site, looked like a monstrously excessive code in Processing (he recycled some of it from the Processing forum, wrote some it himself and translated the rest from Codea). Originally, he was gong to use the code to expand the 3D vector animation he made into a roller-coaster project he saw on Codea and wanted to create in Processing, but got stuck with the colors. What happened next was fascinating. In the evening I all of a sudden saw Simon write in a new online editor Repl.it – he was translating the vector code into… Python! He hadn’t used Python for quite a while. I don’t know what triggered it, maybe Daniel Shiffman noting last night during the live stream session that “normal people use Python for machine learning”. Simon also said he had sone some reading about Python at Python for Beginners and Tree House!

He isn’t done with his project in Python yet, but here is the link to it online: https://repl.it/JAeQ/13

Here Simon explains what he is writing in Python:

Simon did the 2D, 3D and 4D classes but eventually got stuck with the matrix class in Python. He then opened his old Xamarin IDE and wrote the 2D, the 3D and the 4D classes in C#. In the video below he briefly shows his C# sketch and talks about Cross Product in general:

And this is a video he recorded about vector functions (in Processing, Java) the day before:

What is Simon’s level in coding and problem solving?

Simon carried out a project on his new RaspberryPi today that allows to see his programming and problem solving level quite well. Luckily I was there on time with my iPhone camera to film and take pictures.

It involved a simple Blink-an-LED code for Python, but note that Simon wrote it completely from memory. Also interesting that since he was missing the M/F jumper wires required for the project he decided to use his broken M/M wires instead, which I thought was quite inventive.

He used Terminal to create a program called led.py, saved and closed the file and opened the File Manager. He looked for the led.py file, but it wasn’t there.  So he hit Shift-Ctrl-F to search for it and found it. He opened the file by right-clicking on it and selected Python 2 (IDLE). He made sure the correct screen appeared and that the Python code was complete. He then ran the code by typing “sudo python led.py” . Unfortunately a syntax error message popped up.

After a moment of hesitation (when I though he maybe would give up) he said he knew what the error was: he missed a couple of comas. After inserting the comas in the Leafpad file he ran the code again. And it worked!! We were both so happy as if we witnessed sheer magic.

 

Later Simon also showed me how to make the LED light burn continuously or turn it off again.

 

img_2496

img_2497

img_2498

img_2500

img_2502

img_2505

The missing comas back in place:

img_2506

img_2508

Code Academy Python Courses, Day 2.

Today we had a much busier day as we had to bike for two hours to get Simon to his Scratch programming class. That said, Code Academy still largely ruled the day. Simon has completed four and a half courses by now and the tasks are getting tougher. Sometimes he finishes a tasks without errors, but mostly not and then he asks me to help debug his code. We sit down together and go through it again and brainstorm and try different variants. Yet it hit me that most of the time it’s not I who finds the final solution but Simon.

python-code-academy-8-2-okt-2016

python-code-academy-9-2-okt-2016

python-code-academy-10-2-okt-2016python-code-academy-11-2-okt-2016

python-code-academy-12-2-okt-2016

python-code-academy-13-2-okt-2016

And he even squeezed some Raspberry Pi Photon Red Board programming in, too:

sparkfun-photon-red-board-1-okt-2016

Code Academy Python Courses

Tuesday morning I briefly showed Code Academy’s website to Simon: “Look, you can learn to code in Python right here. And here’s a list of other coding languages”, – I surfed back to the homepage. Then I went back to the kitchen to make tea. We have an open kitchen so I can watch Simon from where I’m making tea. The next second I saw him flip back to the Python course and start. He only took pauses when I insisted he eat something and come along to the immigration office to pick up our Belgian ID’s. No other pleas to take a break and relax worked. The rest of the time he went on studying, for seven or eight hours. He successfully finished a whopping 60 exercises that day, most of them without any help on my behalf.

python-code-academy-1-okt-2016

python-code-academy-2-okt-2016

python-code-academy-3-okt-2016

python-code-academy-4-okt-2016

python-code-academy-5-okt-2016

python-code-academy-6-okt-2016

python-code-academy-7-2-okt-2016

A badge earned for every completed course:

Simon translates code from Python to Arduino

To write a Python project in Arduino Simon had to calculate how many milliseconds there are in one day, one month and one year. Here he explains how he did that (in Dutch):

This is the result. As it turned later it does contain errors, but still impressive for someone who is only getting acquainted with both languages. The code, that Simon says should be uploaded on New Year’s day at midnight, should be able to send you weather and humidity updates every hour, every day or every month, depending on your personal settings.