Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 491 Bytes

File metadata and controls

27 lines (21 loc) · 491 Bytes

Example

Read the following code

class Pet:
    """Represents a pet."""

my_pet_1 = Pet()
my_pet_1.type = 'cat'
my_pet_1.noise = 'meow'
my_pet_1.full_name = 'Snuffles McGruff'

my_pet_2 = Pet()
my_pet_2.type = 'cat'
my_pet_2.noise = 'meow'
my_pet_2.full_name = 'Snowpounce Flury'

my_pet_3 = Pet()
my_pet_3.type = 'cat'
my_pet_3.noise = 'meow'
my_pet_3.full_name = 'Snickers Snorkel'

my_pets = [my_pet_1, my_pet_2, my_pet_3]
for pet in my_pets:
    print(pet.full_name)