Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created January 8, 2016 23:08
Show Gist options
  • Save easierbycode/d70ca25301ae22985c11 to your computer and use it in GitHub Desktop.
Save easierbycode/d70ca25301ae22985c11 to your computer and use it in GitHub Desktop.
# -*- 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