Given that it is Computer Science in Education week and the last few weeks of term I wanted to wrap up my practical programming lessons for the term with some Python programming challenges.
Why programming challenges?
In the past I’ve used these successfully with lower age groups. In my opinion it helps to validate the work all students have completed during the term, gives every student an idea of where they should be competence wise, but also allows me to stretch some of those more comfortable with the Python language.
My students will be sitting CIE 9608 Computer Science exams in May/June where their ability to create or understand pseudocode or actual code will be very important. I don’t want to concentrate purely on their ability to regurgitate past paper answers and internal assessment don’t need to closely follow what is to come in the final exam (although I do have three elements to my internal assesssments and one of these is structured around the theory exams), so I’ve made this section entirely practical and open book.
Why let the students use their notes during challenges and assessments?
It’s all about building confidence. If I see a student completing a challenge and staring at a blank screen I can intervene and support them. If I see a student staring at a blank space where their program code should be during an exam I will have failed them as a teacher. Letting students use a computer also opens up the opportunity to use the Internet to help them research their response.
As well as building confidene I want them to be under a little bit of time pressure, allowing them to decide on the strategy for completing the problem. I’ve made the challenge too difficult to Google but broken down into steps so that they can identify practice programs which might help them come up with a solution.
I also make it clear there is no single correct solution and this matches the life of a software developer in the real world. So far student have come up with amazingly diverse ways of solving the same challenge.
What about administration of these challenges?
Collecting and providing feedback on these challenges is pretty easy now they are all set up with GitHub accounts. Students have become adept at pushing code to their repositories and I was amazed at how confident they were using it this week compared to just over two months ago.
I’ve attached my most recent challenge. Have a go or share it with your class… and let me know if you upload your solution to GitHub…
Since starting my new role as Director of IT Systems and Computer Science in August I’ve been planning how to enhance the resources students have access to in the classroom. I use a blended learning model which mixes “traditional” lessons with pre-reading/watching/listening tasks for homework followed by practical application of the concepts covered when the students return to class.
Why the textbook was required
Put simply, there were no suitable resources for teaching the AS students the basics of computer programming. It is important that students make the link between pseudocode (not exactly program code, but close enough to see the logic of a solution) and the Python 3.x language the students use in class. So I decided to have screenshots of the Python code (I use Pythonista 3, which is still the best programming app out there for iPad) on each page next to a video where I write out the related pseudocode. The students responding positively to this method so I kept the style and layout of each page consistent.
Why I decided to use Book Creator
I decided to use Book Creator as a means of creating my AS Computer Science programming textbook because
I was lucky enough to have access to an iPad (although there is a web version available)
I wanted to embed videos but didn’t want to explore the myriad possibilities of iBooks Author
I wanted to output an ePub version as well as a PDF for students.
As my classroom is essentially BYOD I published the first few version of the book to our shared Google Drive as ePub and PDF versions. This was when a student kindly pointed out the videos didn’t work in PDF, so I added a link to a YouTube playlist of videos to each page.
The ePub was also difficult for students to access unless they had an iPad or device with a good ePub reader installed. I then remembered about Book Creator’s Teacher account which allows you to publish up to 10 books on their site. This allowed me to share a link to the online book and ensure that the students get the intended experience.
The students are moving onto more complex programming concepts this term so I’ve already begun creating a second textbook. I would also like to inspire my students to create their own Book Creator programming portfolios which contain images, text, audio and video to help them revise for the AS and A2 exams in the future. I was really impressed with the ease of use of Book Creator and once I had come up with a simple consistent layout and worked out what was possible with the app it was very straightforward to create the book over a number of weeks. I think I prefer the iPad app to the website at the moment because I got more done on trains and planes (without access to WiFi) than when I was in the classroom.
The textbook is embedded below. Any comments on any aspect of the book would be gratefully appreciated.
You can also find out more about Book Creator’s resources for teachers here.
One of the nice and not-so-nice things about vague arrangements documents is that you have to work out how to best fill the gap.
Encryption methods are part of the Computer Security section of the course – symmetric and asymmetric encryption to be exact – and, while I could simply put two slides up on the screen and move on, I saw this as an opportunity to break away from exam style questions and have a little bit of practical fun with the students.
I introduced my Year 10 students to the Caesar cipher this week, surprised that very few of them had even heard of it. They caught on quickly though and were soon manually translating coded messages back into plaintext.
But as the lesson progressed the messages got longer and the students began to find translation very time consuming. So, after a bit of discussion, we decided it might be best to ask a computer to do the translation for us. We would still provide the ciper-text and shift key, and it would do the rest.
This allowed us (imagine that) to then recap on relevant pre-defined functions to translate characters into ASCII codes and then build an algorithm to apply the shift key to these ASCII codes. Once the codes were converted back to characters they were ready to display on the screen! Most students managed to get to this point, with some even working on alternatives (more on that later).
The next day the students returned and were given a tougher challenge: decryption without the shift key! We discussed the letter frequency graph shown above and tried to create an algorithm to accurately calculate the shift key.
The open-endedness of this task challenged everyone and the variety of solutions suggested touched on some of the actual decryption methods utilised.
A few students suggested a brute force decryption of a digest of the entire message, looking for a small number of short English words before comparing the calculated shift key to the frequency analysis graph. When challenged further they explained that this would decrease the processing time of the decryption algorithm as it wouldn’t have to translate as many characters. Some students had even had researched further to find out which were the most used English words in written text!
The students rounded off the lesson by creating a list of advantages and disadvantages of symmetric encryption. While students took longer on the concepts it gave them the opportunity to understand some of the ideas and issues with this type of encryption.
Next week we tackle asymmetric encryption. I can’t wait!
For the third blog post on this topic I wanted to use Python to generate different pieces of art without relying entirely on the random function. I decided to use the tweepy library, mainly because I had already used it to post content to Twitter but had never investigated how it could be used to read information back from Twitter.
It didn’t take long to find out how to read the latest 10 tweets from my own timeline using Python. Then I split the individual words into a list and sorted them into alphabetical order (for no real reason at the moment, but frequency analysis will follow!). Then I used the write method from the Turtle graphics library to place each word at a random location on the screen. This was my first attempt:
A bit tricky to read the words I thought. And I’d accidentally forgotten to penup before moving the turtle. However this accidental vector spider web became part of the artwork (because when I removed it, it looked quite boring).
A little while later I was able to change the font size at random (I changed the font to palatino after experimenting with a few others) and changing the pencolor in the same way as previous Python art programs changed the text colour too.
I had a lot of text to display, even just from 10 tweets, so I thought of ways to reduce the amount. I wrote a little Python subroutine that removed hashtags, mentions and URLs (as well as any other non ASCII text) and that was enough!
The video below shows the program in action. I decided to make a video this time because you can make out the individual words much more clearly at the beginning of the drawing than at the end!
As before the code is now on github (with my tweepy details removed for security). I’ve left in a commented out section of code that allows you to run a search for a keyword, hashtag or phrase instead of taking the latest timeline so you can experiment.
Any comments or improvements would be much appreciated!
I had a lot of fun experimenting with the subroutines and Python Turtle methods yesterday but wanted to push it a little further and find out if I could make use of a new Python library to help create automated art.
Somehow I’ve never built a program that utilises and analyses audio before, so challenged myself to find out more about libraries such as PyAudio and Wave this afternoon. My daughter was practising piano in the other room so it gave me a push to integrate live audio into my solution, rather than rely on pre-recorded wav files.
I learned about numpy a little this afternoon too. I hadn’t realised it had functions to extract the frequency from an audio block (FFT). The more I explore Python, the more I fall in love with it as a language!
Once I’d successfully extracted numeric frequencies from the 5 second wave file into a list I looped through them and attempted to place shapes on the Python Turtle screen to correlate with the current frequency. I decided on a simple X axis plot to begin with but then, as I realised the range between min and max frequencies usually exceeded 8000 I introduced a scale factor so they could be seen on the screen together and adjusted the Y axis so that each frequency appeared bottom to top in the order of analysis.
Quite nice, but there’s a lot of white space where the unused frequency range lies. Instead of removing this range from the visualisation (which, in retrospect, might have been a good idea) I decided to attempt to create ghosts of the circles fading out as they get further from the original position. This led me into colorsys and all sorts of bother, reminding me (eventually) not to mess with anything that returns a Tuple until I convert it back to a List first. Anyway, I removed that part of the code and put my arty effects on the back burner. You can see one example of the mess below. Ugh.
I decided to alter the colour of the background this time too. I think I’d like to use some audio analysis to decide on the colour range in a future version so that low audio frequencies create darker images and high frequencies create bright, bubblegum pop images.
The last thing I added to the program was the option to use pre-recorded audio WAV files instead of always recording 5 seconds of audio. This was very easy to add as I’d modularised the code as I went, so all that was needed was a few lines extra in the main program:
Trying out the program with a few WAV files from www.findsounds.com or playing a YouTube video in the background resulted in the following images:
I wanted to create a task that allowed students to create a computer program in Python that would automatically create its own artwork but be customisable so that each student could experiment and personalise their own program to their tastes.
It’s a rough Python 3 program using the Turtle library and an array of Turtles but so far it has produced some really nice work. In the images shown below the program uses a user-defined function that draws a randomly sized square. I thought this would be easy for the students to understand and hack into something new!
Of course art can be created as a response to an external stimulus so a possible extension of this program would be to get input from the user (colours, mood, age) or calculate a range of colours from an input sensor or device (temperature, time, image).
The code is below! Any suggestions or improvements would be appreciated!
wn = turtle.Screen()
w = wn.window_width()
h = wn.window_height()
def square(item, size):
for x in range(4):
for iteration in range(3):
for item in turtles:
for move in range(2500):
for item in turtles:
It has been a few weeks since our CodeBugs arrived here in Milan and after playing around with some of the sample programs and thinking about their features I have decided to use these with next session’s Year 10 students as an introduction to the iGCSE Computer Science course in September.
While they worked really well with the Raspberry Pi I struggled to get the CodeBugs working with IDLE on the MacBook. Installing packages via Terminal updated the Python 2.7 install that comes with the OS and – for me anyway – Homebrew complicated what should have been a very easy process. In Visual Studio if you wanted to use a module library you simply added it to the project and IDLE does not have this function.
I found PyCharm today – an IDE for Python that allows me to add the codebug_tether module (and any others I need) with the minimum of fuss. Now my CodeBug can be programmed while connected via USB to my MacBook! As an added bonus I learned more about Virtual Environments.
To make it easier for my students to get going with their CodeBugs in September I created a 20-step guide linked here. It’s CC0 so please feel free to use and adapt as required. If you find any mistakes or it just doesn’t work for you in the same way please let me know.
EdPuzzle is not a new site to me, however I’ve never had the time to sit down and investigate it properly. I got the opportunity today as the rain made an overdue visit to Milan.
My Year 10 Computer Science students are revisiting the Python language and I gauged their knowledge during class last week. As they all selected similar problems to solve I decided to share my solutions via video and take advantage of the embedded questioning offered by EdPuzzle.
I had intended to link to the finished EdPuzzle from a Google Form and then mark student submissions using Flubaroo however I was happy to see that EdPuzzle linked to Google Classroom and recorded student results and progress for me.
I’ve attached a quick video walkthrough of one of the tasks below, in case you want to see how it works. I think that next time I’ll make one video so that students do not have two tasks to complete but would appreciate any other feedback or suggestions!
After some discussion with a friend and former colleague (and some thinking over a few coffees) I was inspired to post a short tweet yesterday:
My aim is to get a small number of schools involved in a Google Hangout on Friday 11th December, code together and learn a little about how Computer Science is taught in schools in different parts of the world.
Even if timezones prevent schools from taking part in the Google Hangout there is still a chance to take part.
As Russel Tarr’s recent response to a high-profile attack on his methods of teaching the history of the Weimar Republic (1918-33) gathers deservedly increasing views across the Internet, other parts of Michael Gove’s “Mr. Men” speech align with my concerns about the move away from teaching of ICT in schools and its replacement with (the far more high-brow sounding) Computing Science.
“As long as there are people in education making excuses for failure, cursing future generations with a culture of low expectations, denying children access to the best that has been thought and written, because Nemo and the Mister Men are more relevant, the battle needs to be joined.” (Michael Gove, 2013)
Contrast with one of the recommendations from the Next Gen. report mentioned by Michael Gove:
“Recommendation 3: Use video games and visual effects at school to draw greater numbers of young
people into STEM and computer science.” (Next Gen., Ian Livingstone & Alex Hope, 2011)
The draw of the shiny and new! As scenarios go I would far rather create video games or animations related to Finding Nemo or the Mr. Men than Of Mice and Men and Henry V and I’m pretty sure my students would too, given the choice. Seriously though, creating video games and visual effects using industry-standard software applications requires advanced problem solving skills, application of mathematics and physics and understanding of how a computer system can turn instructions into actions on the screen. It also involves management skills, teamwork, design and creativity. My concern is that a large number of schools are using the headline “games design”, “app design” or “computer animation” to try and reverse declining numbers taking the subject, then use the same teaching methods as they did with package skills…
“What has been wrong with education and IT is that it has been very much focused on the clerical aspect of IT – Microsoft Word, Powerpoint – and that has gone into every remit of the curriculum. It is about giving students access and inspiration so when they go into the wider world of work they are part of the technological advances of the country.” (Depute Principal of St Matthew Academy, http://www.bbc.co.uk/news/education-16186705)
“It was a boring set of documents that encouraged boring teaching of boring tasks in a field which should be one of the most exciting in education. The ICT curriculum we inherited was a tedious run-through the use of applications which were becoming obsolete even as the curriculum was being written.” (Michael Gove again, 2013)
Interest in film production, digital games and media arts preferred
Multitasking skills – Working on multiple projects with strict deadlines
Ability to work well in a multi-cultural team environment with diverse personalities
Strong verbal and written communication skills
Computer skills: Microsoft Word, Excel, Outlook. FileMaker Pro experience a plus.
So an interest in digital media would be desired but most important are: social skills, time management, presentation skills and ICT skills to aid communication (wouldn’t that be classed as clerical skills?). The only other nod to multimedia computing on the page is a request to “link to your online/downloadable reel or portfolio (if you have these)”. Yes this is just one example but highlights the need for continued teaching of ICT. Perhaps just in a different way?
As a programmer I’m glad the focus has been shifted back to using computer systems to create software or link to hardware devices such as the Raspberry Pi or Arduino but without ICT skills linked to the essential processes involved in the world of work and Higher Education, you risk creating skilled coders who are unable to apply for and retain the jobs waiting for them to fill.
“For children who have become digital natives and who speak fluent technology as an additional language, the ICT curriculum was clearly inadequate.” (more from Michael Gove, 2013)
Perhaps rigour in teaching ICT skills and ensuring that the skills they learn are relevant to the rest of the curriculum at the right time would make them more useful. I’m keen on not having ICT on the timetable as it identifies it as a unique entity – unrelated to other subjects the student encounters at school. Tracking progress at primary school and allowing individual students to follow challenging pathways which further develop their skills is tricky to plan and implement, but I think also extremely important.
Here’s why: Children are, in the main, not digital natives. They might wear the badge with honour but, without developing their understanding of what a “digital native” actually is, you may find they are wearing that badge upside down. Students may be confident enough to explore and experiment when faced with a new software application but find it very difficult to recall practical skills when the Computing department see them for around an hour each week (if you’re lucky!).
The solution mooted in Scotland a few years ago was to teach ICT in every subject and leave the programming and multimedia-specific elements to Computing Science teachers. Increased exposure to tasks which relied on students applying their ICT skills to solve problems, create reports or prepare presentations would reinforce practical skills and re-engage disaffected learners. Great idea, poorly planned and implemented due to a stunning lack of staff CPD, limited resources for using ICT in all subjects, corporate filtering and application deployment systems and push-back by subject teachers who felt they had enough to cover already without also including ICT in their remit. It is understandable: staff need to trust that the technology will work consistently enough to be able to teach their subject content. If it is unreliable and the root cause is not remedied, it will be treated as a strategy that does not provide benefit to the student – and abandoned.
The current pedagogy of how ICT lessons are delivered, assessed and reinforced must change to suit the needs of the individual learner.