Re: [Tutor] Exercise to work on

2014-08-14 Thread P McCombs
On Aug 12, 2014 3:29 PM, "keith papa" wrote: > > Hi, am a newbie to python and I wondering if you guys can give me some exercise to work on. I have learned: print function , if function , strings, variables, and raw_input. The more the better Checkio.org is a game made of python coding challenges

Re: [Tutor] Exercise to work on

2014-08-13 Thread Greg Markham
Keith, This should get you started... http://learnpythonthehardway.org/book/ http://www.codecademy.com/en/tracks/python http://docs.python-guide.org/en/latest/intro/learning/ Happy coding! --Greg On Tue, Aug 12, 2014 at 1:52 PM, keith papa wrote: > Hi, am a newbie to python and I wonderin

Re: [Tutor] Exercise to work on

2014-08-13 Thread Joseph Lee
Hi Keith, It depends on what you want to do with Python in the end (by the way, if statement is not a function). Here are some of my suggestions (based on current topics and things to come later): 1. Write a loop which prints even numbers from 1 to 100. 2. Write a program which determines

Re: [Tutor] Exercise to work on

2014-08-13 Thread Joseph Lee
Hi Keith, As a follow-up: I'm sure others might have mentioned this, but I also recommend doing exercises presented in the book or reference you're using to learn Python. Cheers, Joseph - Original Message - From: keith papa Hi, am a newbie to python and I wondering if you guys can give

Re: [Tutor] Exercise to work on

2014-08-12 Thread Danny Yoo
On Tue, Aug 12, 2014 at 1:52 PM, keith papa wrote: > Hi, am a newbie to python and I wondering if you guys can give me some > exercise to work on. I have learned: print function , if function , strings, > variables, and raw_input. The more the better Do you find yourself doing certain kinds of co

[Tutor] Exercise to work on

2014-08-12 Thread keith papa
Hi, am a newbie to python and I wondering if you guys can give me some exercise to work on. I have learned: print function , if function , strings, variables, and raw_input. The more the better ___ Tutor maillist

Re: [Tutor] exercise (while loop)

2014-04-01 Thread Danny Yoo
> So this call will always try to round None(the default return value) > And of course it produces no output since it prints nothing. > > Are you sure that's actually what is in the book? No. That's very much why I wanted a reference to the original source of the problem. Scott attributed too m

Re: [Tutor] exercise (while loop)

2014-04-01 Thread Alan Gauld
On 01/04/14 02:07, Scott W Dunning wrote: I’m working on a few exercises and I’m a little stuck on this one. This is what the book has but it just gives me an endless loop. def square_root(a, eps=1e-6): while True: print x y = (x + a/x) / 2

Re: [Tutor] exercise (while loop)

2014-04-01 Thread Dave Angel
Scott W Dunning Wrote in message: > I’m working on a few exercises and I’m a little stuck on this one. > > This is what the book has but it just gives me an endless loop. > > def square_root(a, eps=1e-6): > while True: > print x > y = (x + a/x) / 2 >

Re: [Tutor] exercise (while loop)

2014-04-01 Thread Mark Lawrence
On 01/04/2014 02:47, Danny Yoo wrote: On Mar 31, 2014 6:22 PM, "Scott W Dunning" mailto:scott@cox.net>> wrote: > > I’m working on a few exercises and I’m a little stuck on this one. > > This is what the book has but it just gives me an endless loop. > > def square_root(a, eps=1e-6): >

Re: [Tutor] exercise (while loop)

2014-03-31 Thread Scott W Dunning
On Mar 31, 2014, at 7:10 PM, Danny Yoo wrote: Thanks for the info Danny! I’ll try that and I should be able to figure it out with your help! The book I was referring to is greentreepress. ___ Tutor maillist - Tutor@python.org To unsubscribe or c

Re: [Tutor] exercise (while loop)

2014-03-31 Thread Danny Yoo
On Mon, Mar 31, 2014 at 8:48 PM, Scott W Dunning wrote: > > On Mar 31, 2014, at 7:10 PM, Danny Yoo wrote: > Thanks for the info Danny! I’ll try that and I should be able to figure it > out with your help! > > The book I was referring to is greentreepress. The reason I'm asking is I want to do

Re: [Tutor] exercise (while loop)

2014-03-31 Thread Danny Yoo
> I tweaked it to what I thought was correct but when I test it I get nothing > back. > > def square_root(a, eps=1e-6): >x = a/2.0 >while True: >y = (x + a/x)/2.0 >if abs(x - y) < eps: >return y >x = y > > round(square_root(9)) > > The way I tweaked it s

Re: [Tutor] exercise (while loop)

2014-03-31 Thread Danny Yoo
Also, which book? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] exercise (while loop)

2014-03-31 Thread Danny Yoo
On Mar 31, 2014 6:22 PM, "Scott W Dunning" wrote: > > I’m working on a few exercises and I’m a little stuck on this one. > > This is what the book has but it just gives me an endless loop. > > def square_root(a, eps=1e-6): > while True: > print x > y = (x +

[Tutor] exercise (while loop)

2014-03-31 Thread Scott W Dunning
I’m working on a few exercises and I’m a little stuck on this one. This is what the book has but it just gives me an endless loop. def square_root(a, eps=1e-6): while True: print x y = (x + a/x) / 2 if abs(y-x) < epsilon:

Re: [Tutor] exercise

2012-12-14 Thread Matthew Ngaha
> return {e for (e, g) in self.sort_email.items() > if g & groups_list} > guys i think ive got it. The & in that comprehension was really confusing me, but i found out it means intersection, so i took the sets manually and saw the results i got using intersection and it became more

Re: [Tutor] exercise with classes 2nd attempt

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 05:23, "Tonu Mikk" wrote: > > I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions for playing the game. For extra credit

[Tutor] exercise with classes 2nd attempt

2012-02-11 Thread Tonu Mikk
I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions fo

Re: [Tutor] exercise with classes

2012-02-09 Thread Joel Goldstick
On Thu, Feb 9, 2012 at 2:23 PM, Tonu Mikk wrote: > > > On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel wrote: >> >> On 02/06/2012 01:24 PM, Tonu Mikk wrote: >>> >>> Now I get an error:  NameError: global name 'self' is not define. >>> >>> Tonu >>> >>> >> Put your remarks after the stuff you quote.  Y

Re: [Tutor] exercise with classes

2012-02-09 Thread Dave Angel
On 02/09/2012 02:23 PM, Tonu Mikk wrote: On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel wrote: On 02/06/2012 01:24 PM, Tonu Mikk wrote: Now I get an error: NameError: global name 'self' is not define. Tonu Put your remarks after the stuff you quote. You're top-posting, which makes the r

Re: [Tutor] exercise with classes

2012-02-09 Thread Tonu Mikk
On Mon, Feb 6, 2012 at 12:58 PM, Dave Angel wrote: > On 02/06/2012 01:24 PM, Tonu Mikk wrote: > >> Now I get an error: NameError: global name 'self' is not define. >> >> Tonu >> >> >> Put your remarks after the stuff you quote. You're top-posting, which > makes the reply difficult to follow. >

Re: [Tutor] exercise with classes

2012-02-06 Thread Dave Angel
On 02/06/2012 01:24 PM, Tonu Mikk wrote: Now I get an error: NameError: global name 'self' is not define. Tonu Put your remarks after the stuff you quote. You're top-posting, which makes the reply difficult to follow. Use copy/paste to describe an error message. You retyped the one above

Re: [Tutor] exercise with classes

2012-02-06 Thread Tonu Mikk
Now I get an error: NameError: global name 'self' is not define. Tonu On Mon, Feb 6, 2012 at 10:19 AM, Nate Lastname wrote: > Hey Tonu, > > The problem is that in your statement definition, you are not > including the self argument. Your definition needs to be something > like: > def dolt(sel

Re: [Tutor] exercise with classes

2012-02-06 Thread Alan Gauld
On 06/02/12 16:12, Tonu Mikk wrote: Alan, thanks for explaining about passing objects to classes. This is an important concept for me to understand. I tried running the code, but run into an error that I could not resolve: TypeError: doIt() takes no arguments (1 given). Sorry the code was on

Re: [Tutor] exercise with classes

2012-02-06 Thread Nate Lastname
Hey Tonu, The problem is that in your statement definition, you are not including the self argument. Your definition needs to be something like: def dolt(self): # Do stuff. For more info on the self keyword, see http://docs.python.org/tutorial/classes.html, section 9.3.2. On 2/6/12, Tonu Mikk

Re: [Tutor] exercise with classes

2012-02-06 Thread Tonu Mikk
Alan, thanks for explaining about passing objects to classes. This is an important concept for me to understand. I tried running the code, but run into an error that I could not resolve: TypeError: doIt() takes no arguments (1 given). Tonu On Thu, Feb 2, 2012 at 7:09 PM, Alan Gauld wrote: > O

Re: [Tutor] exercise with classes

2012-02-02 Thread Alan Gauld
On 02/02/12 17:36, Tonu Mikk wrote: So far I have searched for info on how to pass variables from one class to another and have been able to create a small two class program (attached). But I seem unable to generalize from here and apply this to the game exercise. What would you suggest for m

Re: [Tutor] exercise with classes

2012-02-02 Thread Alexander Etter
On Feb 2, 2012, at 12:36, Tonu Mikk wrote: > I feel stumped and don't know how to go about creating this game with two > classes. > > So far I have searched for info on how to pass variables from one class to > another and have been able to create a small two class program (attached). > Tha

Re: [Tutor] exercise with classes

2012-02-02 Thread Prasad, Ramit
>I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. >I reached exercise 42 where we learn about Python classes. The exercise shows >a game with one class that includes all the definitions for playing the game. >For extra credit we are asked to create another version

[Tutor] exercise with classes

2012-02-02 Thread Tonu Mikk
I am learning Python using the "Learn Python the Hard Way" book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions fo

Re: [Tutor] Exercise suggestions

2011-01-22 Thread Steven D'Aprano
Elwin Estle wrote: I seem to remember that Python (is it supposed to be capitalized? Official logo is in lower case) The official logo of Apple doesn't even have an "A" in it, but we don't spell the company "pple" :) By long-standing convention and practice, the programming language is s

Re: [Tutor] Exercise suggestions

2011-01-22 Thread Alan Gauld
"michael scott" wrote don't need a person walking me through it, a simple, "build a program that asks a user to give you a name and create permutations of it" is great. Of course that example is elementary, but that is the gist of the responses I'm looking for. So have you done it yet? An

Re: [Tutor] Exercise suggestions

2011-01-22 Thread wesley chun
> [...] I'm finding that I > understand concepts, but have no real way to implement them. > > So now my problem emerges... can anyone give me suggestions of exercises I > should do to help improve  my knowledge of what I can "actually" do with the > concepts I have. michael, first of all, welcom

Re: [Tutor] Exercise suggestions

2011-01-22 Thread Elwin Estle
itors or terrorists...or even environmentalists. ...anyway, you get the idea.  Perhaps a lame idea in the context of today's 3D graphical games,  but if properly implemented...maybe it would be fun. --- On Sat, 1/22/11, michael scott wrote: From: michael scott Subject: [Tutor] Exercise su

Re: [Tutor] Exercise suggestions

2011-01-22 Thread ian douglas
For me, the quickest way to jump into a programming language was seeing a current open source project and say "I wish it did this too, or that instead ..." and implement it myself. Not only do you learn about the project itself, and pick up some tips and tricks along the way, you then also have

Re: [Tutor] Exercise suggestions

2011-01-22 Thread Elwin Estle
are all sorts of scenarios in the above for one to analyze and create code to simulate, etc. Enough of my blathering.   Basicallyfind something, a problem, an imaginary idea like a game, and then figure out how to apply programming solutions to that problem. --- On Sat, 1/22/11, michael scott wro

Re: [Tutor] Exercise suggestions

2011-01-22 Thread Corey Richardson
On 01/22/2011 03:09 PM, David Hutto wrote: When I felt I was ready to start doing some work, I got involved in an open source project. It's definitely an experience! Try going through http://freshmeat.net/ Isn't that for those that aren't given real apprenticeship?:) Programming is my hobby,

Re: [Tutor] Exercise suggestions

2011-01-22 Thread R. Alan Monroe
> I just have no idea of what kind of programs to build, Some of the stock answers for this question are: http://projecteuler.net/ http://www.pythonchallenge.com/ I usually suggest porting one of the old games in: http://www.atariarchives.org/basicgames/ Alan ___

Re: [Tutor] Exercise suggestions

2011-01-22 Thread David Hutto
On Sat, Jan 22, 2011 at 3:02 PM, Corey Richardson wrote: > On 01/22/2011 11:56 AM, michael scott wrote: >> >> I am new to programming, I intend to get an entry level job programming >> next year (or a little bit longer). I am switching fields and not going >> to college, but kinda "self teaching"

Re: [Tutor] Exercise suggestions

2011-01-22 Thread Corey Richardson
On 01/22/2011 11:56 AM, michael scott wrote: I am new to programming, I intend to get an entry level job programming next year (or a little bit longer). I am switching fields and not going to college, but kinda "self teaching" myself through various methods. I currently understand concepts in pro

[Tutor] Exercise suggestions

2011-01-22 Thread michael scott
I am new to programming, I intend to get an entry level job programming next year (or a little bit longer). I am switching fields and not going to college, but kinda "self teaching" myself through various methods. I currently understand concepts in programming in python up to classes (like I un

Re: [Tutor] exercise correct ??

2010-09-07 Thread Roelof Wobben
Date: Tue, 7 Sep 2010 00:52:38 -0700 From: alan.ga...@btinternet.com Subject: Re: [Tutor] exercise correct ?? To: rwob...@hotmail.com; tutor@python.org Oke, the 4 is a starting point for the index. Next problem. The begin looks like this : index_of(5, (1, 2, 4, 5, 6, 10, 5, 5

Re: [Tutor] exercise correct ??

2010-09-07 Thread ALAN GAULD
Oke, the 4 is a starting point for the index. > >Next problem. > >The begin looks like this : > > index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) > >But in the module I get this result : > >val = 5 >seq = (1, 2, 4, 5, 6, 10, 5, 5 > >So the 4 is not avaible anymore. > Yes it is. It is the start par

Re: [Tutor] exercise correct ??

2010-09-07 Thread Roelof Wobben
the header to index(val, seq, start=0) to index (val, seq, start) But I think that's not what the exercise wants. Is there another way I can use the 4 ? Roelof > To: tutor@python.org > From: alan.ga...@btinternet.com > Date: Mon, 6 Sep 2010 23:28:22 +0100 > Su

Re: [Tutor] exercise correct ??

2010-09-06 Thread Alan Gauld
"Roelof Wobben" wrote # def index_of(val, seq, start=0): """ >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) 6 """ But I get this message : Failed example: index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) Expected: 6 Got: 3 # But in that tuple 5 is

Re: [Tutor] exercise correct ??

2010-09-06 Thread Sander Sweers
On 6 September 2010 21:45, Sander Sweers wrote: >> Is the exercise here wrong ? > > Looks like it, or it's a typo. Now that I had a better look the test is correct. Now it is up to you to figure out why your index_of() fails. Walter gave you a good hint. Greets Sander ___

Re: [Tutor] exercise correct ??

2010-09-06 Thread Sander Sweers
On 6 September 2010 22:28, Roelof Wobben wrote: > As far as I know index is not a part of tuple so I have to convert it to a > list so I can use index. As of version 2.6/3 a tuple does have index(). Not sure which version you are using. Greets Sander _

Re: [Tutor] exercise correct ??

2010-09-06 Thread Roelof Wobben
> Date: Mon, 6 Sep 2010 21:45:17 +0200 > Subject: Re: [Tutor] exercise correct ?? > From: sander.swe...@gmail.com > To: rwob...@hotmail.com > CC: tutor@python.org > > On 6 September 2010 19:32, Roelof Wobben wrote: > > def index_of(val, seq, start=0): > >

Re: [Tutor] exercise correct ??

2010-09-06 Thread Walter Prins
Hi Roelof, On 6 September 2010 18:32, Roelof Wobben wrote: >>>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) > 6 > > But in that tuple 5 is on position 3. > > Is the exercise here wrong ? > > Not neccesarily... I notice that the call is similar to the previous test case, but has an

Re: [Tutor] exercise correct ??

2010-09-06 Thread Sander Sweers
On 6 September 2010 19:32, Roelof Wobben wrote: > def index_of(val, seq, start=0): >     """ >   >>> index_of(9, [1, 7, 11, 9, 10]) >   3 >   >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5)) >   3 >   >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) >   6 >   >>> index_of('y', '

[Tutor] exercise correct ??

2010-09-06 Thread Roelof Wobben
Hello, I have this programm : def index_of(val, seq, start=0): """ >>> index_of(9, [1, 7, 11, 9, 10]) 3 >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5)) 3 >>> index_of(5, (1, 2, 4, 5, 6, 10, 5, 5), 4) 6 >>> index_of('y', 'happy birthday') 4

Re: [Tutor] exercise problem

2010-08-27 Thread Alan Gauld
"Dave Angel" wrote while teller < len(u): getal1 = u[teller] + v[teller] uitkomst = uitkomst + str(getal1) But then I get a list of string instead of integers. You're close. Now that you've initialized the result variable to [], you can use + just as you're doing. Just

Re: [Tutor] exercise problem

2010-08-27 Thread Dave Angel
Roelof Wobben wrote: Date: Fri, 27 Aug 2010 14:27:34 -0400 From: da...@ieee.org To: rwob...@hotmail.com CC: alan.ga...@btinternet.com; tutor@python.org Subject: Re: [Tutor] exercise problem The other problem is you're confusing the variables inside the function with the ones dec

Re: [Tutor] exercise problem

2010-08-27 Thread Francesco Loffredo
We are close to the solution, keep trying! On 27/08/2010 19.56, Roelof Wobben wrote: Hello, Now I have this : def add_vectors(u, v): """ >>> add_vectors([1, 0], [1, 1]) [2, 1] >>> add_vectors([1, 2], [1, 4]) [2, 6] >>> add_vectors([1, 2, 1], [1, 4, 3]) [2, 6, 4] >>> add_vectors([11, 0, -4,

Re: [Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
> Date: Fri, 27 Aug 2010 14:27:34 -0400 > From: da...@ieee.org > To: rwob...@hotmail.com > CC: alan.ga...@btinternet.com; tutor@python.org > Subject: Re: [Tutor] exercise problem > > (Don't top-post, it loses all the context) > > Roelof Wobben wrote: > &g

Re: [Tutor] exercise problem

2010-08-27 Thread Dave Angel
(Don't top-post, it loses all the context) Roelof Wobben wrote: Hello, Now I have this : def add_vectors(u, v): """ >>> add_vectors([1, 0], [1, 1]) [2, 1] >>> add_vectors([1, 2], [1, 4]) [2, 6] >>> add_vectors([1, 2, 1], [1, 4, 3]) [2, 6, 4]

Re: [Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
e. Roelof Date: Fri, 27 Aug 2010 10:19:30 -0700 From: alan.ga...@btinternet.com Subject: Re: [Tutor] exercise problem To: rwob...@hotmail.com >u v, result first example. u : [1.0] v: [1,1] result [2.1] OK, Great, you got that. first split u en v in only numbers. No, you shoul

Re: [Tutor] exercise problem

2010-08-27 Thread christopher . henk
Roelof Wobben wrote on 08/27/2010 12:18:01 PM: > > > > Date: Fri, 27 Aug 2010 12:00:23 -0400 > > From: bgai...@gmail.com > > To: rwob...@hotmail.com > > CC: tutor@python.org > > Subject: Re: [Tutor] exercise problem > > > > I have been reading yo

Re: [Tutor] exercise problem

2010-08-27 Thread Francesco Loffredo
On 27/08/2010 17.05, Roelof Wobben wrote: Hello, My first try : def add_vectors(u, v): """ >>> add_vectors([1, 0], [1, 1]) [2, 1] >>> add_vectors([1, 2], [1, 4]) [2, 6] >>> add_vectors([1, 2, 1], [1, 4, 3]) [2, 6, 4] >>> add_vectors([11, 0, -4, 5], [2, -4, 17, 0]) [13, -4, 13, 5] """ teller

Re: [Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
> Date: Fri, 27 Aug 2010 12:00:23 -0400 > From: bgai...@gmail.com > To: rwob...@hotmail.com > CC: tutor@python.org > Subject: Re: [Tutor] exercise problem > > I have been reading your posts and responses. I find myself frustrated > with your lack of understanding of

[Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
workspace\oefeningen\src\test.py", line 28, in uitkomst = add_vectors(u,v) File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 17, in add_vectors getal1 = getal1 + u[teller,0] + v[teller,0]TypeError: list indices must be integers, not tuple Roelof Date: Fri, 27 Aug

Re: [Tutor] exercise problem

2010-08-27 Thread bob gailer
I have been reading your posts and responses. I find myself frustrated with your lack of understanding of Python fundamentals and the time and energy others are putting in that seems to help only a little. I recommend you take a very basic tutorial, and be sure you understand the basic concep

Re: [Tutor] exercise problem

2010-08-27 Thread Walter Prins
Hi Roelof, See below On 27 August 2010 16:05, Roelof Wobben wrote: > > uitkomst = add_vectors[u,v] > > But now I get this error message : > > > Traceback (most recent call last): > *File "C:\Users\wobben\workspace\oefeningen\src\test.py", line 27, in > * > > uitkomst = add_vectors[u,v] > > Type

Re: [Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
#x27;function' object is not subscriptable So it seems that I can't use vectors as a variable in a function. Roelof From: rwob...@hotmail.com To: tutor@python.org Subject: RE: [Tutor] exercise problem Date: Fri, 27 Aug 2010 14:38:23 + Oke, That's also

Re: [Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
; Date: Sat, 28 Aug 2010 00:15:15 +1000 > Subject: Re: [Tutor] exercise problem > > On Fri, 27 Aug 2010 08:23:06 pm Roelof Wobben wrote: > > > > Write a function add_vectors(u, v) that takes two lists of > > > > numbers > [...] > > My new idea is that u i

Re: [Tutor] exercise problem

2010-08-27 Thread Steven D'Aprano
On Fri, 27 Aug 2010 08:23:06 pm Roelof Wobben wrote: > > > Write a function add_vectors(u, v) that takes two lists of > > > numbers [...] > My new idea is that u is the number which must be calculated and v is > the vector which containts the outcome or u is the outcome of the > first numbers and v

Re: [Tutor] exercise problem

2010-08-27 Thread Francesco Loffredo
On 27/08/2010 12.23, Roelof Wobben wrote: From: rwob...@hotmail.com To: alan.ga...@btinternet.com Subject: RE: [Tutor] exercise problem Date: Fri, 27 Aug 2010 07:04:39 + > To: tutor@python.org > From: a

Re: [Tutor] exercise problem

2010-08-27 Thread Roelof Wobben
From: rwob...@hotmail.com To: alan.ga...@btinternet.com Subject: RE: [Tutor] exercise problem Date: Fri, 27 Aug 2010 07:04:39 + > To: tutor@python.org > From: alan.ga...@btinternet.com > Date: Thu, 26 Aug 2010 23:54:19 +0100 > Subject: Re: [Tutor] exercise problem

Re: [Tutor] exercise problem

2010-08-26 Thread Alan Gauld
"Roelof Wobben" wrote Write a function add_vectors(u, v) that takes two lists of numbers I think that u is the name of the new list and v is the number which represent the number which must be eveluated. No. It sounds like you don't really understand the basic concepts behind functions yet

Re: [Tutor] exercise problem

2010-08-26 Thread Emile van Sebille
On 8/26/2010 12:02 PM Roelof Wobben said... Hello, I have this exercise: Lists can be used to represent mathematical vectors. In this exercise and several that follow you will write functions to perform standard operations on vectors. Create a file named vectors.py and write Python code to m

[Tutor] exercise problem

2010-08-26 Thread Roelof Wobben
Hello, I have this exercise: Lists can be used to represent mathematical vectors. In this exercise and several that follow you will write functions to perform standard operations on vectors. Create a file named vectors.py and write Python code to make the doctests for each function pass. W

Re: [Tutor] Exercise in writing a python function

2006-08-09 Thread Alan Gauld
> I confused things by my mistake in the specifications. > > The criterion for exiting the outer loop is that > > mpylist[0][1] * mult[0] + mpylist[1][1] * mult[1] + mpylist[2][1] * > mult[2] > + . . . > > be > zlim. Can you try rewriting the spec correctly, because I'm still not sure I understan

[Tutor] Exercise in writing a python function

2006-08-09 Thread Kermit Rose
Message: 2 Date: Wed, 9 Aug 2006 16:04:27 +1200 From: "John Fouhy" <[EMAIL PROTECTED]> Subject: Re: [Tutor] Exercise in writing a python function. To: "Tutor mailing list" Hi Kermit, Your basic data structure is a list (actually, several related lists), which

Re: [Tutor] Exercise in writing a python function.

2006-08-09 Thread Kermit Rose
From: Alan Gauld Date: 08/09/06 03:30:28 To: Kermit Rose; tutor@python.org Subject: Re: [Tutor] Exercise in writing a python function. > The current specifications for the function are: > > def incr(mult,z,zlim,mpylist): > # mult is a vector of exponents for the multiplier

Re: [Tutor] Exercise in writing a python function.

2006-08-09 Thread Alan Gauld
> The current specifications for the function are: > > def incr(mult,z,zlim,mpylist): > # mult is a vector of exponents for the multipliers in mpylist. > # z is a positive odd integer. > # zlim is the upper bound critical value for the sum of ( > mpylist[k][0] * > mpylist[k][1] ) Just to clari

Re: [Tutor] Exercise in writing a python function.

2006-08-08 Thread John Fouhy
On 09/08/06, Kermit Rose <[EMAIL PROTECTED]> wrote: > Hello John. > > Thanks for replying. > > In my previous version, I used z as the critical value,. > > Since I created zlim, a function of z, to be passed in as a parameter, I no > longer need z > > in the parameter list. > > In another part of

Re: [Tutor] Exercise in writing a python function.

2006-08-08 Thread John Fouhy
On 09/08/06, Kermit Rose <[EMAIL PROTECTED]> wrote: > def incr(mult,z,zlim,mpylist): > # mult is a vector of exponents for the multipliers in mpylist. > # z is a positive odd integer. > # zlim is the upper bound critical value for the sum of ( mpylist[k][0] * > mpylist[k][1] ) > # where kth mult

[Tutor] Exercise in writing a python function.

2006-08-08 Thread Kermit Rose
Hello all. I feel more familar with Python now, and when I recently went back to reading the tutorial, I could actually read it without being overwhelmed by too much new detail. I've been staring at the specs for a python function for a while. I wrote one version of it and it worked.