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'

    def set_type(self, animal_type):
        self.__animal_type = animal_type

    def set_age(self, age):
        self.__age = age

    def get_name(self):
        return self.__name

    def get_animal_type(self):
        return self.__animal_type

    def get_age(self):
        return self.__age

# create methods,  set_name , set_animal_type, set_age,  get_name, 
get_animal_type
# get_age

# write a program that creates an object of the class and prompts the use to 
enter
# name, type, age of their pet.

# data should be stored as objects attributes.
# use objects accessor methods to retrieve the pet's name, type and age
# display data on screen

# __author__ = 'stephaniequiles'
def main():
    name = input('what is the name of the pet?: ')
    animal_type = ('Please enter a type of pet: ')
    age = int(input('Enter age of pet: '))
    self.get_name(name, animal_type, age)
    print('This will be saved to file.')
    print('Here is a the data you entered: ')
    print('Pet Name: ', pet.get_name)
    print('Animal Type:', pet.get_animal_type)
    print('Age: ', pet.get_age)


main()






_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to