On 16/06/2015 17:45, Stephanie Quiles wrote:
Hello, Having trouble figuring out why this program is not running. could
someone please take a look and see where I am going wrong? Here is the error
message i am getting :
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4
/Users/stephaniequiles/PycharmProjects/untitled3/pets.py
Traceback (most recent call last):
File "/Users/stephaniequiles/PycharmProjects/untitled3/pets.py", line 2, in
<module>
def main(get_name=name):
NameError: name 'name' is not defined
Process finished with exit code 1
Thanks !!!!
Code is below:
# __author__ = 'stephaniequiles'
# write a class named Pet should include __name, __animal_type, __age
class Pet:
# pet class should have an __init__ method that creates these attributes.
def __init__(self, name, animal_type, age):
self.__name = 'name'
self.__animal_type = 'animal_type'
self.__age = 'age'
def set_name(self, name):
self.__name = 'name'
Further to Alan's answer the above methods are wrong. You're setting
all the instance variables to strings instead of the actual variable
names. Get rid of the single quotes.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor