Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

My father's a British actuary, so growing up we had an amusing variation on this game, often played in the car during long trips. In addition to 'fizz' (3) and 'buzz' (5) we would also play with 'sausage' (7) to make the game a bit more challenging.

Of course, after someone had made a mistake, they had to drop out, which changed what order the fizz, buzz or sausage came around to you. And I don't think we ever made it as far as the first 'fizz-buzz-sausage' -- 105.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Update: OK, let's see if I can pass the code testing bit:

#!/usr/bin/perl -w use strict; { for (1..100) { my @a; push(@a,'fizz') if ($_%3==0); push(@a,'buzz') if ($_%5==0); push(@a,'sausage') if ($_%7==0); if (@a) { print join(' ',@a) . "\n"; } else { print "$_\n"; } } }
OK, except for a typo (I had 6 instead of 7) it worked first time. I guess I'm not too thumb-fingered.

ps No, that was obviously *not* golfed. ;)


In reply to Re: Golf Challenge: FizzBuzz by talexb
in thread Golf Challenge: FizzBuzz by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (8)
    As of 2014-12-29 15:24 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (192 votes), past polls