I have a class that is set up like this`
class Vehicle:
def __init__(self, seats, wheels, engine):
self.seats = seats
self.wheels = wheels
self.engine = engine
And I am given an instance like this
porsche = Vehicle(2, 4, "gas")
what I can't figure out is how to use the instance "porsche" to write out to the screen the names of each self initialization in the "__init__
" section.
The desired output is a sentence like this:
"I have a Vehicle. It has seats, wheels, and an engine."
Where seats wheels and engine are coming from the class.
I retrieved Vehicle and put it into the string using this:
porsche.__class__.__name__
But for the life of me can't figure out how to get each self.
object