@AshaRajagopal/

critter_zoo_starter

Python

notes to demonstrate containment

fork
loading
Files
  • main.py
  • critter_zoo.py
  • critter.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# main function to test out Critter and Critter_zoo classes

# can create multiple classes within one .py file, or import them like this...
from critter import Critter #from Critter.py, import class Critter
from critter_zoo import Critter_zoo
def main():
  zoo1 = Critter_zoo("Naperville Critter zoo")#zoo objects
  crit1 = Critter("joel")#critter objects
  crit2 = Critter("abby", "blue", "salty")
  crit3 = Critter("Bob","green","Jealous")
  zoo1.add_critter(crit1) #add critters to zoo
  zoo1.add_critter(crit2)
  zoo1.add_critter(crit3)
  print(zoo1)
  critter_list = zoo1.get_crits()
  for i in critter_list:
    print(i)
  
  input("\nPress enter to exit.")

main()