• Archive
  • RSS
  • Ask me anything

Daniel Stucke

FizzBuzz CodeYear Fun #schoolstech

With todays announcement from Mr Gove it seems a good point to reflect on my first steps on a year long coding journey. I spent my Tuesday evening completing the first week of lessons on the brilliant CodeYear. It took me about an hour and a half and was a great little introduction to Javascript. First week covers defining variables, basic arithmetic, and moves on to if/then/else/while statements.

It’s an interesting learning model, there are hints at each stage and I didn’t find myself stuck on too many occasions. If you teach ICT or Maths then I’d thoroughly recommend you take a look at it. It was quite a challenge and I’ll be interested to see how far students could get without a teacher to help them. If they do get stuck, some good Googling skills would help them find a way forward pretty quickly. It’s not a replacement for a skilled teacher thought, but that’s a conversation for another post!

The final bonus challenge is to write a FizzBuzz program that writes out a set of consecutive numbers, but replaces multiples of 3 with “Fizz” and multiple of 5 with “Buzz” and of course, multiples of both with “FizzBuzz”. It’s a great little challenge that the Maths teacher in me loved!

I’ve been encouraging staff and students at school to join me on this journey so it’ll be interesting to see how many are up for the challenge.

Here’s my final FizzBuzz code in case you’re interested or stuck:

// Ask user how far we should Fizz Buzz for
var Total = prompt("How far shall we fizz buzz?");

// for the numbers 1 through to Total,
for (i=1; i<=Total; i++) { 

  // if the number is divisible by 3, write "Fizz"
  if ( i % 3 === 0 ) { 
    // unless the number is also divisible by 5, then write "FizzBuzz"
    if ( i % 5 === 0 ) {
    console.log("FizzBuzz");
    }
      else 
        console.log("Fizz");
  }

  // if the number is divisible by 5, write "Buzz"
  else if (i % 5 === 0 ){
    console.log("Buzz");
  }

  // otherwise, write just the number
  else {
    console.log(i);
  }
}

Has anyone written this in a neater, purer way? I’d love to see it if you have.

EDIT:

I have to include this, a solution in a tweet by Martyn Colliver:

    • #Code Academy
    • #codeacademy
    • #coding
    • #programming
    • #ictcurric
    • #ict
    • #maths
    • #Fizz Buzz
    • #codeyear
    • #Javascript
    • #technology
    • #education
    • #teaching
  • 1 year ago
  • 13
  • Comments
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

13 Notes/ Hide

  1. marthaji02 likes this
  2. emileeyou89 likes this
  3. heatheryi982 likes this
  4. danielstucke posted this

Recent comments

Blog comments powered by Disqus
← Previous • Next →

About

Avatar Assistant Headteacher from Manchester, UK. This is a space for my thoughts on education, technology and more. My older ramblings can be found at http://mrstucke.com

Pages

  • Tags

Me, Elsewhere

  • @danielstucke on Twitter
  • SHSELearning on Youtube
  • Mr Stucke on Flickr
  • mrstucke on Delicious
  • danielstucke on Pinboard
  • danielstucke on Last.fm
  • danielstucke on Foursquare
  • Google
  • My Skype Info
  • Linkedin Profile

Twitter

loading tweets…

Following

  • parislemon
  • instagram
  • jkottke
  • reviewinhaiku
  • coolcatteacher
  • minimalmac
  • thoughtshrapnel
  • willrichardson
  • gamebased
  • misseducate
  • dougbelshaw
  • weirdosareheroes
  • untanglingtheweb
  • jsmummert
  • minecraftteacher
  • jami-es
  • therationalradical
  • stuartridout
  • ijohnpederson
  • nikjft
  • feltron
  • fndgs
  • mightybell
  • ifttt
  • mresmres
  • yelpingwithcormac
  • dajbelshaw
  • raisingachievement
  • ketangart
  • sebastianscheerer
  • dttoolkit
  • loudmouthman

I Dig These Posts

  • Photo via minimalmac

    And… The link to the previous app made me realize that I’ve never given headline space to DaisyDisk. This despite loving the heck out of it and...

    Photo via minimalmac
  • Video via jsmummert
    Video

    prussiahasinvaded:

    Holland vs the Netherlands

    CGPGrey

    I really needed this.

    Video via jsmummert
  • Photo via minimalmac

    Typerighter is a new application that I have been testing for a while. As the developer is a close personal friend of mine and willing to listen...

    Photo via minimalmac
  • Link via parislemon
    Don't Let The Door Hit You On The Way Out Of Google Reader

    Google is ripping out the underlying social stuff in Google Reader — stuff that never...

    Link via parislemon
See more →
  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Creative Commons License
This work by Daniel Stucke is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at danielstucke.com..

Effector Theme by Pixel Union