[Tutor] problem with program in python in easy steps
Chris Coleman
anrkris at gmail.com
Thu Oct 26 16:02:34 EDT 2017
i wrote these programs and saved them per instructions on page 128 and 129
in the book "python in easy steps".
class Person:
'''A base class to define Person properties.'''
def__init__(self,name):
self.name = name
def speak( self,msg = '(Calling The Base Class)'):
print(self.name,msg)
from Person import*
'''A derived class to define Man properties.'''
class Man(Person):
def speak(self,msg):
print(self.name,':\n\tHello!',msg)
from Person import*
'''A derived class to define Hombre properties.'''
class Hombre(Person):
def speak(self,msg):
print(self.name,':\n\tHola!',msg)
from Man import*
from Hombre import*
guy_1 = Man('Richard')
guy_2 = Hombre('Ricardo')
guy_1.speak('It\'s a beautiful evening.\n')
guy_2.speak('Es una tarde hermosa.\n')
Person.speak(guy_1)
Person.speak(guy_2)
i ran the program override.py and get this error message:
Traceback (most recent call last):
File "scripts/override.py", line 1, in <module>
from Man import*
File "/home/chris/scripts/Man.py", line 2
'''A derived class to define Man properties.'''
^
IndentationError: unexpected indent
More information about the Tutor
mailing list