Untitled
unknown
python
2 years ago
832 B
7
Indexable
# Online Python compiler (interpreter) to run Python online. # Write Python 3 code in this online editor and run it. class Cafe: def __init__(self): self.coffeePool = [] def order(self, coffee): if coffee not in self.coffeePool: self.coffeePool.append(coffee) print("Ordering " + coffee + " adding " + coffee + " to pool") else: print("Ordering " + coffee + " not adding " + coffee + " to pool, because someone not collected it") def collect(self, coffee): self.coffeePool.remove(coffee) print("collecting " + coffee + "from the coffee pool") if __name__ == "__main__": print("dupa") cafe = Cafe(); cafe.order("espresso"); cafe.order("latte"); #someone leaves cafe.order("latte"); cafe.collect("latte");
Editor is loading...