The official UK Hour of Code is upon us (starting March 3rd) and to celebrate, the Computing Department is holding it’s very own Code Off’s.
At lunchtimes (T2 from 12:15) on Wednesday 4th, Thursday 5th & Friday 6th March you will have the chance to pit your skills against other coders to find out who’s the fastest programmer when it comes to solving small mathematical based problems. The competition is open to students in years 7-11.
Register as soon as possible with Mr Smith via email or in person. I’m looking for 8 people to take part and anyone else is welcome to come and watch or do some coding yourself.
The language of choice for these competitions is Python (version 2.x) so brush up on your skills over at Codecademy. Here’s a sample question to get you going…
32768 is a number and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
Write a program that can calculate the sum of the digits of any given number
The solution in Python is something like:
num = raw_input("Please enter a number")
total = 0
for each in num:
total = total + int(each)