[Tutor] Use flag to exit?

Richard D. Moores rdmoores at gmail.com
Thu Jun 24 12:15:25 CEST 2010


On Thu, Jun 24, 2010 at 02:33, Eike Welk <eike.welk at gmx.net> wrote:
> On Thursday June 24 2010 09:16:05 Richard D. Moores wrote:
>
>> I did what you said (<http://tutoree7.pastebin.com/JiFS0b0K>), and get
>> "invalid syntax" for the comma in line 40.
>
> Are you using Python 3? (I'm using Python 2.6) For Python 3 the correct syntax
> of the except clause is:
>
> except FoundPrimeException as e:
>
> See:
> http://docs.python.org/py3k/tutorial/errors.html#handling-exceptions
>
>> The prime greater than or equal to 100 is 101
>> Traceback (most recent call last):
>>   File "C:/P31Working/prime_to_biggest_prime_tutor2_Eike2.py", line
>> 40, in <module>
>>     except (FoundPrimeException, e):
>> NameError: name 'FoundPrimeException' is not defined
>
> You have to define the class FoundPrimeException. The definition is in the
> first part of my email. I think a good place for it is before the function
> definitions.

OK. See <http://tutoree7.pastebin.com/v4T98iRL>. What now?

Dick


More information about the Tutor mailing list