Python Class Exercises

Let’s check out some exercises that will help understand Classes better.

Exercise 4-a: Simple Class Attributes (name and origin)

A class regarding an imaginary jet inventory is already defined for you. Also an instant of this Jet class is created and assigned to variable first_item.

Print the name of the first_item.

You can call the name attribute with adding it to an instance of the class such as:

Exercise 4-b: Simple attribute (origin)

This time print the origin of the first_item.

Origin attribute can simply be shown as: