python code to create a Class called Car for automobile objects. The class constructor a color attribute. Be sure to include a constructor with the color parameter. The constructor should include a message that a Car of the appropriate color has been created.


here is my code:

class Car(object):
    """A automoblie"""
    def _init_(self):
        print "color is"
    def talk(self):
        print "im a car"

automoblie = car()
automoblie.talk()

i get this error code of:

Traceback (most recent call last):
  File "E:\88.py", line 8, in <module>
    automoblie = car()
NameError: name 'car' is not defined

Code is case sensitive, so car != Car ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.