Re: [Tutor] Writing Function Definitions

2013-10-09 Thread Dave Angel
On 9/10/2013 07:35, Chris Down wrote: > On 2013-10-09 11:28, Dave Angel wrote: >> Alan's suggestions pretty much cover mine. Make your code readable, >> rather than clever while you're learning. > > s/while you're learning// > But by the time you learn enough, you realize that when you stop lear

Re: [Tutor] Writing Function Definitions

2013-10-09 Thread Chris Down
On 2013-10-09 11:28, Dave Angel wrote: > Alan's suggestions pretty much cover mine. Make your code readable, > rather than clever while you're learning. s/while you're learning// pgpjKcnwi1MeE.pgp Description: PGP signature ___ Tutor maillist - Tuto

Re: [Tutor] Writing Function Definitions

2013-10-09 Thread Dave Angel
On 8/10/2013 18:50, Connor Hood wrote: > Hi, I am taking a class in order to learn Python. Welcome to Python, and to Python-tutor. > One of the exercises I need to do is write function definitions. I > cannot figure out how to do one of them. To show you an example here is a > similar problem:

Re: [Tutor] Writing Function Definitions

2013-10-09 Thread Alan Gauld
On 08/10/13 23:50, Connor Hood wrote: # isPrime(m): I -> Bool # If m is an integer, then isPrime(m) if and only if m is prime. def isPrime(m): return False if m <= 1 else isPrimeItr(1,0,m) # isPrimeItr(i,a,m): I x I x I -> Bool def isPrimeItr(i,a,m): return False if a> 2 else True if

Re: [Tutor] Writing Function Definitions

2013-10-09 Thread Chris Down
Hi Connor, On 2013-10-08 17:50, Connor Hood wrote: > Hi, I am taking a class in order to learn Python. One of the exercises I need > to do is write function definitions. I cannot figure out how to do one of > them. To show you an example here is a similar problem: > If m is an integer, then isP

[Tutor] Writing Function Definitions

2013-10-09 Thread Connor Hood
Hi, I am taking a class in order to learn Python. One of the exercises I need to do is write function definitions. I cannot figure out how to do one of them. To show you an example here is a similar problem: If m is an integer, then isPrime(m) iff m is prime.The code: # Prompts the user for an in