-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdogs.py
executable file
·46 lines (35 loc) · 939 Bytes
/
dogs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
dogs.py
Created on Jan 20, 2015
@author: cleonard
'''
petID = (0, 1)
petName = ("Gypsie", "Pocahontas")
petType = ("Kind of a dachsund", "Finnicky cat")
petGender = "Female"
petSize = "XS"
petOwnerPrimaryFirstName = "Margie"
petOwnerPrimaryLastName = "Leonard"
petOwnerOtherFirstName = "Chris"
petOwnerOtherLastName = "Leonard"
gypsie = {
"petName": "Gypsie",
"petType": "Awesome",
"lastRabiesShot": "2014-11-05",
"OwnerFirstName": "Margie",
"OwnerLastName": "Leonard"
}
poco = {
"petName": "Pocahontas",
"petType": "Kitty cat",
"OwnerFirstName": "Margie",
"OwnerLastName": "Leonard"
}
def getPetAttribute(pet, attributeName):
try:
return(pet[attributeName])
except:
return("Invalid attribute name {0}.".format(attributeName))
print(getPetAttribute(gypsie, "petName"))
print(getPetAttribute(poco, "petType"))
print(getPetAttribute(poco, "lastRabiesShot"))