[DFW.pm] Homework for the list, and for Oct 08 meeting
Lisa Cloutier
staurofilax77 at gmail.com
Thu Sep 11 10:15:07 PDT 2014
Solution below:
my $x = 1;
while ($x <= 100)
{
if (($x % 3 == 0) && ($x % 5 == 0))
{
print "FizzBuzz\n";
}
elsif ($x % 3 == 0)
{
print "Fizz\n";
}
elsif ($x % 5 == 0)
{
print "Buzz\n";
}
else
{
print "$x\n";
}
$x++;
}
I minorly "cheated" in that I didn't know the sign in Perl for "mod" but
had read Bob's email previously (before learning about the challenge) and
realized what he was doing with the % sign. Had I been in an interview I
probably would have used every special character in turn until I figured
out the symbol for mod.
So I guess I can "program my way out of a wet paper bag" as this website
<http://c2.com/cgi/wiki?FizzBuzzTest> proclaimed about the FizzBuzz test.
On Thu, Sep 11, 2014 at 11:42 AM, John Fields <wigthft at gmail.com> wrote:
> Firstly, I want to thank John Dexter for his Docker presentation, showing
> how to encapsulate a Mojolicious Web server and application for easy
> deployment. He got what all presenters get, a free dinner and that warm
> afterglow from making the world a better place (with more Perl in it). :)
>
> I challenged the attendees last night to do the FizzBuzz program. We even
> had one programmer in attendance that had been asked to do it on a job
> interview the previous day! We were one day late for him, but hopefully
> not for you..
>
> Http://rosettecode.org/wiki/FizzBuzz
>
> Don't cheat.. Yourself. Do it from scratch before looking at other's
> solutions. We will pick 2 more, with increasing difficulty with one per
> week. Also new member Andy Sohn will offer a short challenge and
> demonstrate answers live at the next Mongers.
>
> So send in your code, and be as creative as you can! TIMTOWTDI is a
> strength after all. :)
>
> Cheers,
> John and Tommy
>
> _______________________________________________
> Dfw-pm mailing list
> Dfw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/dfw-pm
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20140911/5a09a9b5/attachment-0001.html>
More information about the Dfw-pm
mailing list