| brent timothy saner on 13 Sep 2017 11:38:52 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [PLUG] Why Can't Programmers.. Program? |
On 09/13/2017 11:09 AM, Gavin W. Burris wrote:
> As soon as I read this, I was immediately compelled to write code. :P
>
> for N in 1 to 100:
> msg = N
> modthree = N % 3
> modfive = N % 5
> if modthree == 0:
> if modfive == 0:
> msg = "FizzBuzz"
> else:
> msg = "Fizz"
> else if modfive == 0:
> msg = "Buzz"
> print msg
>
here's mine; seems y'all forgot you can do multiple condition in one
test in python! (sorry for any mangling; my email client does some funny
things sometimes.)
______________________________
#!/usr/bin/env python3
n = 100
i = 1
while i <= n:
if (i % 3 == 0) and (i % 5 == 0):
print('FizzBuzz')
elif (i % 3 == 0):
print('Fizz')
elif (i % 5 == 0):
print('Buzz')
else:
print(i)
i += 1
______________________________
but more to the point of TFA itself, i find it *horrifying* that there
are people looking for dev jobs that can't at least do SOME sort of
iteration of this (honestly, things like multiple conds in one test are
debatable- actually getting the right result isn't). i'm not even a
developer, i'm in operations- but this is still terrifying to me.
Attachment:
signature.asc
Description: OpenPGP digital 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