As a followup to “Popeyes”, here’s the same code implemented with Python:
if n < 1:
elif n < 3:
return 2 ** (n / 3 - 1)
if __name__ == "__main__":
n = 0
n = int(sys.argv)
n = input("How many chicken fingers? ")
print "You will receive %g dipping sauces." % popeyes(n)
Nothing special, but it’s a cool comparison to Haskell’s code.
Michael Dippery is a writer and developer living in sunny San Francisco, CA. He is the author of Professional Swift.
Email him at email@example.com.
View his projects on GitHub.
There are 223 articles on Monkey Robot.