Re: [Tutor] Need help adding a funcation

2011-12-02 Thread Andreas Perstinger
On 2011-12-02 08:22, Michael Hall wrote: I am still not understanding what it is I am being asked to do. Ok, forget about your working program and just concentrate on question 1a): > # a) write a function, getDivisors(), that returns a list of all > # of the positive divisors of a given number

Re: [Tutor] Need help adding a funcation

2011-12-02 Thread Steven D'Aprano
Michael Hall wrote: I am still not understanding what it is I am being asked to do. What is the differance between my_list = [] an my_list[ ] because when I use my_list[] I get an error. Not sure what I am doing wrong. In Python, square brackets [ ] are used for two related but different purpo

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Michael Hall
I am still not understanding what it is I am being asked to do. What is the differance between my_list = [] an my_list[ ] because when I use my_list[] I get an error. Not sure what I am doing wrong. I am asking if you are given the following question how would you write the program. I have most of

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Alan Gauld
On 01/12/11 21:17, Michael Hall wrote: Can anyone else help with this question? Sure lots of us could help. But Dave's doing a good job leading you in the right direction. Is there something that you don't understand? If you ask about specific points we can give specific answers. Meantime I'l

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Michael Hall
Can anyone else help with this question? On Thu, Dec 1, 2011 at 12:17 PM, Dave Angel wrote: > (You top-posted, so I'm deleting all the out-of-order stuff. in these > forums, you should put your response after whatever you quote.) > > > On 12/01/2011 02:55 PM, Michael Hall wrote: > >> The OP has

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Dave Angel
(You top-posted, so I'm deleting all the out-of-order stuff. in these forums, you should put your response after whatever you quote.) On 12/01/2011 02:55 PM, Michael Hall wrote: The OP has been taught but is still having an issue and all I am doing is asking for help. Here is what I have so fa

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Michael Hall
The OP has been taught but is still having an issue and all I am doing is asking for help. Here is what I have so far # 1) a perfect number is a positive integer that is equal to the # sum of its proper positive divisors,excluding the number itself. # for example, 6 is a perfect number because it

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Dave Angel
(You forgot to post your response on the list, instead posting it privately to me. Please use Reply-All, or whatever the equivalent is on your email app) On 12/01/2011 11:49 AM, Michael Hall wrote: On Thu, Dec 1, 2011 at 7:51 AM, Dave Angel wrote: On 12/01/2011 10:33 AM, Michael Hall wro

Re: [Tutor] Need help adding a funcation

2011-12-01 Thread Dave Angel
On 12/01/2011 10:33 AM, Michael Hall wrote: Here is the code I have written. # Create main function. def main(): a = input('Please Enter a Number: ') # Ask user for input. number = int(a) x = 1 sum_of = 0 while number> x: if number % x == 0: sum_of

[Tutor] Need help adding a funcation

2011-12-01 Thread Michael Hall
Here is the code I have written. # Create main function. def main(): a = input('Please Enter a Number: ') # Ask user for input. number = int(a) x = 1 sum_of = 0 while number > x: if number % x == 0: sum_of = sum_of + x x += 1 if sum_of == number: