[Tutor] Find out if a number is even or not

Alan Gauld alan.gauld at freenet.co.uk
Sat Oct 16 19:24:40 CEST 2004

> So, shouldn't that piece of code be:
> return x%2 and 'Odd' or 'Even'
> to make it semantically correct? As it is, it returns 'Odd' for even
> numbers, and vice versa.

Woops! Never post untested code!

You are quite correct.

Alan G.

More information about the Tutor mailing list