def add_new_field(self): print("What kind of field is it: corn or wheat?") type = input() print("How large is the field in hectares?") size = int(input()) Farm.add(type, size) print("Added a {} field of {} hectares!".format(type, size))
from animals import Animal from farm import Farm gekko = Animal() python = Animal() dog = Animal() cat = Animal() frog = Animal() frog.play() frog.play() frog.play() frog.play() new_farm = Farm() new_farm.add(gekko) new_farm.add(python) new_farm.add(cat) new_farm.add(frog) new_farm.add(dog) new_farm.breed() new_farm.slaughter()
from farm import Farm from allat import Allat allatFarm = Farm(5) tigris = Allat() malac = Allat() allatFarm.add(tigris) allatFarm.add(malac) allatFarm.breed() # uj random allat print(allatFarm.allatok) print(tigris.lekerEhseg()) print(malac.lekerEhseg()) malac.eszik() print(malac.lekerEhseg()) allatFarm.slaughter() print(allatFarm.allatok)