Created
January 8, 2016 23:08
-
-
Save easierbycode/d70ca25301ae22985c11 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
cat = { | |
'name' : 'Tom', | |
'weight' : 9.5, | |
'hungry' : True, | |
'photo' : '▓▒░({ =^⦿◬⦿^= })░▒▓', | |
'emoji' : '😸' | |
} | |
mouse = { | |
'name' : 'Jerry', | |
'weight' : 1.5, | |
'hungry' : False, | |
'photo' : '⁌:3 )~~~~' | |
} | |
pets = [cat, mouse] | |
def feed( pet ): | |
if pet['hungry'] == True: | |
pet['hungry'] = False | |
pet['weight'] = pet['weight'] + 1 | |
print pet['name'] + ' now weighs ', pet['weight'] | |
else: | |
print pet['name'] + " isn't hungry" | |
for pet in pets: | |
if 'emoji' in pet: | |
print pet['emoji'] | |
else: | |
print pet['photo'] | |
feed( pet ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment