Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyLSV
#python 3.6.9 #pyLSV #this code is created by Rezaul Hoque on January 18,2022;contact: jewelmrh@yahoo.com,Dhaka, Bangladesh #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; from abc import ABC, abstractmethod class Details(ABC): @abstractmethod def print(self, describe): pass class FruitPlot(Details): def __init__(self, fruit): self.fruit = fruit def print(self, describe): print(f'{describe} {self.fruit}') class VegPlot(Details): def __init__(self, veg): self.veg = veg def print(self, describe): print(f'{describe} {self.veg}') class Farm: def __init__(self, title, fruit, veg): self.title = title self.fruit = fruit self.veg = veg class FarmInit: def __init__(self, details): self.details = details def add(self, describe): self.details.print(describe) if __name__ == '__main__': farm = Farm('The Farm', 'Fruit Plot is on the north side.','Vegetable Plot is on the south side.') fruitDesc= FruitPlot(farm.fruit) vegDesc = VegPlot(farm.veg) farminit = FarmInit(fruitDesc) farminit.add('That is fruit plot.') farminit.details = vegDesc farminit.add('That is vegetable plot.')
run
|
edit
|
history
|
help
0
Lesson3 part 2
abc
shuru6
.....✓[Guess the number]®®®®®®®•$$$$✓.....
newasd
PyMenu
Bubble sort
PRIMES russian DANILIN
linked_lists_2
Toto