Python Development Course
Chapter
>
Level

Classes and Objects
Class methods

Objective

Grab the materials in the field so you can build the chickens some new houses.

The chickens need some new coups, you can build various types chicken houses using the classes. You can adjust several properties in an object created with a class.

class chicken_house: color = "" size = ""

The above code creates a class with two variables, color and size. You can modify the properties of each object externally.

big_green_house = chicken_house() big_green_house.color = "green" big_green_house.size = "big"

Create 4 different objects named: big_green_house , small_blue_house , big_orange_house , small_red_house . Modify the properties in each of the four objects to match the object’s name.

Collect all planks in the field and walk to the X marks, use the build() function and create all 4 houses.

Code book