コード例 #1
0
ファイル: index.py プロジェクト: TrinityChristiana/py-imports
from appliances import DishWasher, Washer, Dryer, Refrigerator, CoffeeMaker, Stove, CanOpener

whirlpool_dishwasher = DishWasher("black")
whirlpool_dishwasher.wash_dishes()
print(whirlpool_dishwasher)

samsung_washer = Washer("red", "heater")
samsung_washer.wash_clothes("del")
print(samsung_washer)

samsung_dryer = Dryer("red", "gas")
samsung_dryer.dry_clothes("med")
print(samsung_dryer)

lg_fridge = Refrigerator("stainless")
lg_fridge.make_ice()
print(lg_fridge)

mr_coffee = CoffeeMaker("white")
mr_coffee.make_coffee()
print(mr_coffee)

stove_brand = Stove("white")
stove_brand.cook_food()
print(stove_brand)

starbucks = CoffeeMaker("white")
starbucks.make_coffee()
print(starbucks)

canopen = CanOpener("white")
コード例 #2
0
ファイル: index.py プロジェクト: sophiahoffman/python-imports
from appliances import Dishwasher, Washer, Dryer, Refrigerator, CoffeeMaker, CanOpener

whirlpool_dishwasher = Dishwasher("black")
whirlpool_dishwasher.wash_dishes()

samsung_washer = Washer("red", "gas")
samsung_dryer = Dryer("red", "electric")

lg_fridge = Refrigerator("stainless")
lg_fridge.make_ice()

mr_coffee = CoffeeMaker("white")
mr_coffee.make_coffee()

new_can_opener = CanOpener("blue")
new_can_opener.open_can()

# how did I fix?
# changed several defs to class
# added (self) to all the defs functions that were missing it
# created __init__.py file and added imports to all the files
# ensured that all the subclasses had appropriate reference to parent class
# made sure that the required initialization inputs were there
# DishWasher changed to Dishwasher in multiple places
# many references to super were missing ()
コード例 #3
0
ファイル: index.py プロジェクト: holdenprkr/python-imports
from appliances import DishWasher
from appliances import Dryer
from appliances import Washer
from appliances import Refrigerator

whirlpool_dishwasher = DishWasher("black")
whirlpool_dishwasher.wash_dishes()

samsung_washer = Washer("red")
samsung_dryer = Dryer("red", "gas")

lg_fridge = Refrigerator("stainless")
lg_fridge.make_ice()

mr_coffee = CoffeeMaker("white")
mr_coffee.make_coffee()
コード例 #4
0
from appliances import DishWasher
from appliances import Dryer
from appliances import Washer
from appliances import Refrigerator
from appliances import CoffeeMaker
from appliances import CanOpener

whirlpool_dishwasher = DishWasher("black")
whirlpool_dishwasher.wash_dishes()

samsung_washer = Washer("red", "electric")
samsung_dryer = Dryer("red")

lg_fridge = Refrigerator("stainless")
lg_fridge.make_ice()

mr_coffee = CoffeeMaker("white")
mr_coffee.make_coffee()

openCan = CanOpener("silver")
openCan.open_can()