Walt Mankowski on 13 Sep 2017 09:49:45 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Why Can't Programmers.. Program?


On Wed, Sep 13, 2017 at 11:01:44AM -0400, Thomas Delrue wrote:
> I'm going to make an ass of myself, but...

Umm...

> #!/usr/bin/python
> i = 1;
> while (i <= 100):
>     output = "";
>     if (i % 3 == 0):
>         output += "Fizz";
>     if (i % 5 == 0):
>         output += "Buzz";
>     if (output == ""):
>         output = str(i);
> 
>     print(output);
>     i += 1;
> 
> I could do it in other languages as well, but this was the fastest and just 
> off the top of my head...

Remember how I said it's trickier than it looks? :)

Walt

Attachment: signature.asc
Description: PGP signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug