Apr-30-2017, 08:41 PM
Please, repost your code with proper indentation. Most probably that's the problem, but the code in your post does not produce this error
class Dog(object): """A simple attempt to model a dog.""" def __init__(self, name, age): """Initialize name and age attributes.""" self.name = name self.age = age def sit(self): """Simulate a dog sitting in response to a command.""" print(self.name.title() + " is now sitting.") def roll_over(self): """Simulate rolling over in response to acommand.""" print(self.name.title() + " rolled over!") my_dog = Dog('willie', 6) print("My dog's name is " + my_dog.name.title() + ".") print("My dog is " + str(my_dog.age) + " years old.")
Output:My dog's name is Willie.
My dog is 6 years old.