There is only 1 parenthesis on the prior line, but lots of commas. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <tutor@python.org> Sent: Saturday, July 30, 2005 5:22 PM Subject: Re: [Tutor] What's the invalid synax? Error message and codesupplied.
> > I'd count the parenthesis on the prior line: > > > option = int(raw_input('Option (1,2,3,4,5,6,9): ') > while option != 9: > > > Also when you notice that you are copying and pasting the same line over > and > over, it may be time to think about reorganizing the code a little bit > (Once > you have it working). > > Happy Debugging > > --Todd > > > On Saturday 30 July 2005 06:19 pm, Nathan Pinno wrote: >> Here's the message: >> File "D:\Python22\prog4.py", line 19 >> while option != 9: >> ^ >> SyntaxError: invalid syntax >> >> And the code: >> #This program finds the area and perimeter of circles, rectangles, and >> squares. def menu(): >> print '1) Area (Circle)' >> print '2) Area (Rectangle)' >> print '3) Area (Square)' >> print '4) Perimeter (Circle)' >> print '5) Perimeter (Square)' >> print '6) Perimeter (Rectangle)' >> print '9) Exit' >> >> import math >> print 'By Nathan Pinno' >> print 'ID# 2413448' >> print >> print 'Program 4 - Functions' >> print >> menu() >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> while option != 9: >> if option == 1: >> r = int(raw_input('Radius: ') >> print 'The area of the circle = ',pi*(r**2) >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> elif option == 2: >> l = int(raw_input('Length: ') >> w = int(raw_input('Width: ') >> print 'The area of the rectangle = ',l*w >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> elif option == 3: >> s = int(raw_input('Side: ') >> print 'The area of a square = ',s**2 >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> elif option == 4: >> d = int(raw_input('Diameter: ') >> print 'The perimeter of the circle = ',pi*d >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> elif option == 5: >> l = int(raw_input('Length: ') >> w = int(raw_input('Width: ') >> print 'The perimeter of the rectangle = ',(2*l)+(2*w) >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> elif option == 6: >> s = int(raw_input('Side: ') >> print 'The perimeter of a square = ',s*4 >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> else: >> print 'That is not an option. Please choose an option.' >> option = int(raw_input('Option (1,2,3,4,5,6,9): ') >> print 'Goodbye.' > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor