learning to program with Python

Ricardo ric_n_cerq at iol.pt
Sun Feb 22 09:36:26 EST 2004


Hi, my name is Ricardo and i'm learning to program in Python with 
version 2.3.3, i'm also using the latest version of PythonWin(163) but 
i'm trying to do it with a book (Written in Portuguese) that covers the 
version 2.1, and of course i'm having a problem. The code in wich i'm 
having problems is as follows:

class Gato:
	"um felino domesticado"
	def __init__(self, sexo, corPelo=None):
		self.sexo = sexo
		if corPelo != None
		  self.corPelo = corPelo
	def miar(self):
		if self.sexo == "m":
			return "MIAU"
		else:
			return "miauuuu"
the book says that it should be done like this, but when i finnish the 
5th line(if corPelo != None) and press ENTER, it gives me the error:

  Traceback (  File "<interactive input>", line 5
     if corPelo != None
                       ^
SyntaxError: invalid syntax

I hope someone can help me?
Thanks in advance anyway.

Ricardo





More information about the Python-list mailing list