Create a class named Person
Create an instance of Person and assign it to friend
Assign two attributes to friend, name and age, with values "Elira" and 29 respectively.
Create a class, Car
Create a dog, my_car, with two attributes, brand and year.
Change my_car's brand
Add one year to my_car
Create a class named Book
Create an instance of Book and assign it to book
Assign two attributes to book, title and pages, with values "Of Mice And Men" and 120 respectively.
Create a class, Fruit
Create a fruit, f, with one attribute, type.
Change f's type
Create a class that represents city
Create an instance of it and assign it to c
Assign three attributes to it, name, population and is_capital, with values a string, an integer and a boolean respectively.
Create a class, Cup
Create a cup, c, with two attributes, color and volume.
Change c's color
Add 50 to c's volume
Create two classes, Book and Author.
Create an author, writer, with name and age attributes
Create a book, novel, with title: str, pages: int and author: Author attributes.
class House:
"""Represents a house.
attributes: owner, address
"""
class Owner:
"""Represents a house owner.
attributes: name
"""
class Address:
"""Represents an address.
attributes: street
"""
person = Owner()
person.name = "Blerina"
addr = Address()
addr.street = "Rr. Iliria"
h = House()
h.owner, h.address = person, addr
Given the above script:
| What is type of h.owner: | ||
| What is value of h.owner.name: |
Create a class, Shoe
Create a shoe, s, with one attribute, size.
Add 1 to s's size
Create two classes, Backpack and Student.
Create a backpack, bp, with color attribute
Create a student, st, with name: str, grade: int and bag: Backpack attributes.