[EMAIL PROTECTED] wrote: > Hello all, > > I'm a cell biologist that is learning python. I've been following Alan > Gauld's tutorial online and I've hit a wall. > > I'm typing > > class Spam: > """A meat for combining with other foods > > It can be used with other foods to make interesting meals. > It comes with lots of nutrients and can be cooked using many > different techniques""" > > >>>> def__init__(self): > > SyntaxError: invalid syntax > > and I get that error. I've tried several different versions over > several days and I'm stuck.
You should include a space between 'def' and '__init__'. Not doing so is what the SyntaxError complains about. Also, did you type that in IDLE? You shouldn't type two enters after the line with 'different techniques' since IDLE stops the definition of the class if you do that; you should use only one enter in this case. That's a limitation of IDLE, not of Python: if you put that definition in a file, you can use as many empty lines as you like. -- If I have been able to see further, it was only because I stood on the shoulders of giants. -- Isaac Newton Roel Schroeven _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
