3 ms·
> "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buz
by danielamitay 14y ago
> "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”
Aside from explicitly stating "Hey, encapsulate IF/ELIF/ELSE statements in a FOR loop", FizzBuzz doesn't seem too analytical--am I wrong?
- greyfade 14y agoIt seems trivial, but yes, to some degree, it requires a little analytical thinking to get over the hurdle of deciding what to print and when. It's shocking just how many "programmers" can't figure it out, even with a little prompting.
- tehwebguy 14y agoAgree completely, the description is basically pseudocode on its own. There's no abstraction, it's literally instructing the programmer exactly what to do.
- rogerbinns 14y agoI've been interviewing a bit recently and not a single candidate has actually managed to complete it successfully (I use a slightly simpler variation with different numbers and strings). They have all been juniour but all claimed at least a few years of programming experience (counting university/school). Thinking I was going nuts, I tried it out on my colleagues including one whose total programming experience was trying to learn Python a few months ago, and they finished 100% correctly in under a minute. I don't ask for correct syntax, an actual programming language, fret over the 100 being included or not etc. Heck I even ask them what the output would be for the "code" they just wrote and they usually get that wrong too! For a for loop and 3 arms of conditionals. I suspect it is a standin for experience. You can get pretty far copying and pasting sample code you find on the net, maybe altering a number or two. (Or the far more telling commenting blocks of code out.) These days you can have something that appears to work by using project creators and tinkering, but not actually doing a reasonable amount of what could be considered older school programming.
- kabdib 14y agoI ask people to write strlen() for me. (If they don't know C, it's a showstopper, btw). Supposedly senior candidates with ten years of experience have failed this. It's truly amazing. "Oh, I haven't written code in a while" is a common response. That's a show-stopper, too -- what, you want to /manage/ me or something? And you can't write code? God forbid.
- deleted 14y ago[deleted]
- tkahn6 14y agoNo IF/ELIF/ELSE necessary :) take 100 $ zipWith (++) (cycle ["", "", "Fizz"]) $ cycle ["", "", "", "", "Buzz"]