Created
April 14, 2015 20:22
-
-
Save dariosky/a57292374e93bc81381e to your computer and use it in GitHub Desktop.
Tribute to Stevie Wonder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import collections | |
__author__ = "Dario Varotto" | |
""" This was thought while I was showering, sorry :) """ | |
def stevie(): | |
stack = collections.deque() | |
stack.append("from the bottom") | |
stack.append("and I mean it") | |
stack.append('I just called') | |
stack.append('I just called') | |
stack.append('I just called') | |
counter = collections.defaultdict(int) | |
while stack: | |
item = stack.pop() | |
if item.startswith("I"): | |
print item.replace("alle", "ode"), "to say", | |
counter[item] += 1 | |
if counter[item] % 2: | |
print "I love you" | |
else: | |
print "how much I care" | |
else: | |
print item | |
print "of my stack" | |
if __name__ == '__main__': | |
stevie() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment