I think I have several questions before I post my code.
- How do I change the attributes? Everything looks the same and I was basically looking at one of the examples in my book for this problem. The book always has the arguments and attributes as being the same name. I hope that is clear enough.
- How do I get this thing to run? If it does run then I did something right.
- Why does it make another file with the ending ".Pyc" at the end?
- The file is black in color on a windows machine and silver on a Ubuntu machine.
- Last, how do I change the numbers so it reads 1,2,3 instead of all 1's
class Pet: def __init__(self,name,an_type,age): self.name = name self.an_type = an_type self.age = age def set_name(self,name): self.name = name def set_an_type(self,an_type): self.an_type = an_type def set_age(self,age): self.age = age def get_name(self): return self.name def get_an_type(self): return self.an_type def get_age(self): return self.age
import awclassPet def main(): eman = raw_input("What is the name of your Pet?: ") atype = raw_input("What type of animal is it?: ") ega = input("What is the age of your animal?: ") animals = awclassPet.Pet(eman,atype,ega) print animals.get_name() print animals.get_an_type() print animals.get_age() main()