[Tutor] problem with program
breamoreboy at yahoo.co.uk
Fri Oct 13 13:40:08 EDT 2017
On 13/10/17 13:04, Chris Coleman wrote:
> just learning python as my first programming language. going through the
> book "python in easy steps" by mike mcgrath. i am going through the
> programs in chapter 7 and can't get them to work. here is the first one in
> the chapter:
> class Bird:
> '''A base class to define bird properties.'''
> def talk(self):
> return self.sound
> from Bird import*
> print('\nClass Instances Of:\n',Bird._doc_)
> print('\nNumber Of Birds:',polly.count)
> print('Polly Says:',polly.talk())
> print('\nNumber Of Birds:',harry.count)
> print('Harry Says:',harry.talk())
> i am getting this error message:
> File "scripts/bird.py", line 4
You need a space between the `def` and the `__init__`.
> SyntaxError: invalid syntax
> what am i doing or not doing that is causing this?
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
More information about the Tutor