def defaultShelter(shelter): """This is a default Shelter for the purposes of a demo """ shelter.increment_ID() shelter.add_Pet( animals.Dog('German Shepard', 'Fido', 'M', 5, 40, shelter.get_ID(), True), shelter.pet_directory) shelter.increment_ID() shelter.add_Pet( animals.Dog('Golden Retriever', 'Goldy', 'F', 6, 53, shelter.get_ID(), True), shelter.pet_directory) shelter.update_Pet_Status(2, 'Adopted') shelter.increment_ID() shelter.add_Pet( animals.Cat('Mixed', 'Fluffy', 'F', 8, 5, shelter.get_ID(), 'Indoors'), shelter.pet_directory) shelter.increment_ID() shelter.add_Pet( animals.Bird('Parrot', 'Chirps', 'M', 3, 1.3, shelter.get_ID(), 'Both'), shelter.pet_directory) shelter.increment_ID() shelter.add_Pet( animals.Cat('Spinx', 'Mushu', 'F', 2, 6, shelter.get_ID(), 'Indoors'), shelter.pet_directory) shelter.update_Pet_Status(5, 'On-Hold') shelter.increment_ID() shelter.add_Pet( animals.Reptile('Bearded Dragon', 'Toasty', 'Unknown', 4, 2.6, shelter.get_ID(), 92), shelter.pet_directory) shelter.increment_ID() shelter.add_Pet( animals.Rabbit('Unknown', 'Hops', 'F', 1, 3, shelter.get_ID()), shelter.pet_directory) shelter.increment_ID() shelter.add_Pet( animals.Dog('Unknown', 'Ruff', 'M', 3, 30, shelter.get_ID(), False), shelter.pet_drop_directory) shelter.increment_ID() shelter.add_Pet( animals.Bird('Parrot', 'Squeks', 'F', 2, 2, shelter.get_ID(), 'Caged'), shelter.pet_directory) shelter.update_Pet_Status(9, 'On-Hold') shelter.admin_directory.append(Admin('Jacob', 1))
def createPet(self, shelter): #Gets all required info from user pet_info = helper.get_input_pet(shelter.animal_types) #Create appropriate Pet class, increment ID before creating pet to get a unique ID if pet_info[0].lower() == 'dog': shelter.increment_ID() return (animals.Dog(pet_info[1], pet_info[2], pet_info[3], pet_info[4], pet_info[5], shelter.get_ID(), pet_info[6])) elif pet_info[0].lower() == 'cat': shelter.increment_ID() return (animals.Cat(pet_info[1], pet_info[2], pet_info[3], pet_info[4], pet_info[5], shelter.get_ID(), pet_info[6])) elif pet_info[0].lower() == 'bird': shelter.increment_ID() return (animals.Bird(pet_info[1], pet_info[2], pet_info[3], pet_info[4], pet_info[5], shelter.get_ID(), pet_info[6])) elif pet_info[0].lower() == 'reptile': shelter.increment_ID() return (animals.Reptile(pet_info[1], pet_info[2], pet_info[3], pet_info[4], pet_info[5], shelter.get_ID(), pet_info[6])) elif pet_info[0].lower() == 'rabbit': shelter.increment_ID() return (animals.Rabbit(pet_info[1], pet_info[2], pet_info[3], pet_info[4], pet_info[5], shelter.get_ID()))
def main(): # Create a Mammal object, a Dog object, and a Cat object. mammal = animals.Mammal('regular animal') dog = animals.Dog() cat = animals.Cat() # display information about each one. print('Here are some animals and') print('the sounds they make.') print('--------------------------') show_mammal_info(mammal) print() show_mammal_info(dog) print() show_mammal_info(cat)
def main(): mammal = animals.Mammal('Regular Animal') dog = animals.Dog() cat = animals.Cat() print('Animals and the sound they make') print('-----------------------------') show_mammal_info(mammal) print() show_mammal_info(dog) print() show_mammal_info(cat) print() show_mammal_info('I am a string')
def main(): # Create a Mammal object, a Dog object, and # a Cat object. mammals = list() mammals.append(animals.Mammal('regular animal')) mammals.append(animals.Dog()) mammals.append(animals.Cat()) mammals.append(animals.Siberian_Husky()) # Display information about each one. print('Here are some animals and') print('the sounds they make.') print('--------------------------') for mammal in mammals: show_mammal_info(mammal) print()
def main(): mammal = animals.Mammal('regular animal') dog = animals.Dog() cat = animals.Cat() # Display information about each one. print('Here are some animals and' + 'the sounds they make.') print('--------------------------------') show_mammal_info(mammal) print() show_mammal_info(dog) print() show_mammal_info(cat)
def main(): mammal = animals.Mammal('regular animal') dog = animals.Dog() cat = animals.Cat() print('Here are some animals and\nthe sound they make:') print('-------------------------') show_mammal_info(mammal) print() show_mammal_info(dog) print() show_mammal_info(cat)
def main(): # Utworzenie obiektów klas # Mammal, Dog i Cat. mammal = animals.Mammal('zwierzę') dog = animals.Dog() cat = animals.Cat() # Wyświetlenie informacji o każdym zwierzęciu. print('Oto kilka przykładów zwierząt') print('i wydawanych przez nie dźwięków.') print('--------------------------') show_mammal_info(mammal) print() show_mammal_info(dog) print() show_mammal_info(cat)
def main(): # Создать объект Mammal, объект Dog # и объект Cat. mammal = animals.Mammal('Обычное животное') dog = animals.Dog() cat = animals.Cat() # Показать информацию о каждом животном. print('Вот несколько животных и') print('звуки, которые они издают.') print('--------------------------') show_mammal_info(mammal) print() show_mammal_info(dog) print() show_mammal_info(cat)
def main(argv): animal_kind = argv[1] animal_name = argv[2] zoo_worker = argv[3] if animal_kind == 'cat': animal = animals.Cat(animal_name) elif animal_kind == 'dog': animal = animals.Dogfish(animal_name) else: animal = animals.Animal(animal_name, animal_kind) animal.introduce() if animal.kind == 'cat': animal.act(zoo_worker, 'meows') elif animal.kind == 'dog': animal.act(zoo_worker, 'barks') elif animal.kind == 'dogfish' animal.act(zoo_worker, 'stares') else: animal.act(zoo_worker, 'looks confused')
b1 = animals.Butterfly() b1.set_name() b1.set_lifespan("2") b1.displaydetails() b1.animalProperty() print("\n") monkey1 = animals.Monkey() monkey1.set_name() monkey1.set_lifespan("20") monkey1.displaydetails() monkey1.animalProperty() print("\n") cat1 = animals.Cat() cat1.set_name() cat1.set_lifespan("10") cat1.displaydetails() cat1.animalProperty() print("\n") camel1 = animals.Camel() camel1.set_name() camel1.set_lifespan("17") camel1.displaydetails() camel1.animalProperty() print("\n") peacock1 = animals.Peacock() peacock1.set_name()
import animals mammal = animals.Mammal('Regular mammal') mammal.show_species() mammal.make_sound() cat = animals.Cat() cat.show_species() cat.make_sound() dog = animals.Dog() dog.show_species() dog.make_sound()
import animals import dog_park # Initialize / create names for variables that will use animals' methods #required with dunder init in animals file burt = animals.Dog("Burt") ann = animals.Husky("Ann") chippy = animals.Chihuahua("Chippy") zorro = animals.Labrador("Zorro") jake = animals.Cat() dogs = [ animals.Husky("Ann"), animals.Chihuahua("Chippy"), animals.Labrador("Zorro") ] park = dog_park.DogPark(dogs) park.converse() # burt.speak() # burt.eat() # burt.learn_name("Burt") # print (burt.name) burt.call_dog("Come here Burt") burt.call_dog("Burt, do you want to play") burt.call_dog("Come here dumb dog") burt.call_dog("Burt, I have a snack") # jake.eat()