[Tutor] Python code

Alan Gauld alan.gauld at yahoo.co.uk
Tue Nov 1 21:25:47 EDT 2016


On 01/11/16 21:28, Haley Sandherr wrote:
> Hello, I am new to python and need help with this question:

What kind of help? What exactly do you find difficult?
> 
> Compose a function odd ( ) 

Can you define a function? Any function?

> that takes three bool arguments 

Can you define a function that takes arguments - any arguments?
Can you define one that takes exactly 3 arguments?

> and returns True

Can you define a function that returns a value - any value?
Can you define a function that returns True?

>  if an odd number of arguments are True and False otherwise.

Can you test if a value is True?
Can you test if 2 out of 3 are True?
(There are several ways to do this! Some easy and
some harder but shorter )

How far down that list do you get before becoming stuck?

I could show you a single line solution, but I doubt you
would learn very much from it. It is better for you to come
up with your own solution where you actually understand
what every line of code does.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list