"Gman" <[EMAIL PROTECTED]> wrote in message >>>> # Filename: func_param.py >>>> def printMax(a, b): > >>>if a > b: > print a, 'is maximum' > else: > print b, 'is maximum' > printMax(3, 4) > SyntaxError: invalid syntax
OK, I think this is because you have tried to use the function before you finished defining it. And this is not your fault its the books. When you use the >>> prompt you must enter each new command at a >>> prompt. If the >>> isn;t there it means IDLE still thinks you are entering part of the previous command. In this case thats the function definition. So if you just hit return a couple of times at the end of the function you will get back to >>> where you can then enter the last line and it should work. So it should look like (from Pythonwin rather than IDLE): >>> def printMax(a, b): ... if a > b: ... print a, 'is maximum' ... else: ... print b, 'is maximum' ... >>> printMax(3, 4) 4 is maximum >>> HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor