Day Three 2015

We started off the day making a tip and tax calculator. The math calculator program we made yesterday was complicated, so I wanted to simplify the material to make sure the students really understood it. Using string functions, math operations, and a topic the students were familiar with, we explored how variables could be manipulated. After this was done, we began to talk about if, elif, and else statements.

 x = raw_input('Enter a number: ')
 if x < 50 :
     print 'The number, {0}, is less than 50!'.format(x)
     print 'The number, {0}, is greater than 50!'.format(x)

After class was over, I finalized my plans for the three hour web programming workshop I was holding the next day. Both my old students and my new students were going to be there, and I was excited and nervous at the same time. The internet connection at the school is a little flaky, and is very slow when a lot of computers are connected so I was unsure of what to expect. The reason I even decided to teach web programming in the first place is that I had started playing around with it in the past year, and I loved it. I wanted to share this with the students, but wasn't sure how to, until I discovered a program called Google Coder. Coder is a program that can convert a Raspberry Pi into a little server which multiple people can access and code on (with internet connection). I reached out to the creators of Coder, and was able to meet them in New York to ask them for advice. Then back home in California, I downloaded the Coder software onto my own Raspberry Pi B+ and Pi 2. I was going to leave one of my Coder Pis at the Saraswati Niketan School, so I could continue having web programming classes with them virtually over the course of the year.

Then we moved on to for loops, while loops, and what the range(x) function does. This was a lot of material to cover in a short period of time, but the students picked it up pretty quickly.

In the afternoon, we moved on to loops, and discussed for loops, while loops, and what the range(x) function does. This led us into lists. We created a program that asked for the number of students in the class, and then asked for each of their respective names. We stored all of these names in a list and then added and removed from the list as needed.

 num = int(raw_input('How many students are in the class? ')
 class = [raw_input('Enter name number {0}: ').format(var) for var in range(1, num+1)]
 print class

After this, we talked about functions, and what parameters were. We started off really basic, using functions that didn't have any parameters, then moved up to 1, and then to 2.

def power(base, exponent):
     result = base ** exponent
     print '{0} to the power of {1} is {2}.'.format(base, exponent, result)
 power(7, 6)

We combined all of these skills into making a guessing game. I chose a number between 1 and 100, and had the students guess it. We worked on coding the game for the rest of the class. In the evening, I sat outside the Lower school and read for a while. It's actually very interesting not having wifi and not going on social media for almost a week - it made me realize how much precious time I waste doing useless stuff.