Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread Dave Angel
On Wed, 06 Nov 2013 21:42:01 -0800, Alex Kleider wrote: It seems then that one could be critical of the assignment in that it is requiring a function that has side effects which is something that should be discouraged. Classroom assignments are frequently like that. But without context it's

Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread Alex Kleider
On 2013-11-06 20:21, Dave Angel wrote: The plus operator doesn't append to the list; it makes a new one. Doesn't meet spec. Right. It seems then that one could be critical of the assignment in that it is requiring a function that has side effects which is something that should be discouraged

Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread Dave Angel
Alex Kleider wrote: On 2013-11-06 01:52, Oscar Benjamin wrote: > > I'll give one suggestion which is that to concatenate one list onto > the end of another you would use the .extend() method rather than the > .append() method. What would be the advantage/disadvantage of what you suggest vs u

Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread Alex Kleider
On 2013-11-06 01:52, Oscar Benjamin wrote: I'll give one suggestion which is that to concatenate one list onto the end of another you would use the .extend() method rather than the .append() method. What would be the advantage/disadvantage of what you suggest vs using the plus (+) operand as

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Johan Martinez
On Tue, Nov 5, 2013 at 6:19 PM, Steven D'Aprano wrote: > On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: > > I need help in modifying my program. Right now it looks as follows: > [snip code] > > Can someone help me in improving my code? > > Yes! The first thing to do is get rid of

Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread Alan Gauld
On 06/11/13 03:10, Anton Gilb wrote: This is what I've come up with so far, it looks like garbage I know. On the contrary its not too far away. But we'd rather see a garbage first attempt than no attempt at all, at least we then know where the problems lie! list1 = [1,2,3,4,5,6,7,8,9] list2

Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread eryksun
On Tue, Nov 5, 2013 at 10:10 PM, Anton Gilb wrote: > Write a function named transform that takes as arguments > list1, list2, r1, and r2, that removes items from list1 in the slice r1:r2, > appends them onto list2 in reverse order, and returns the resulting list. > For example, in this case, the f

Re: [Tutor] Can someone please help me with this?

2013-11-06 Thread Oscar Benjamin
On 6 November 2013 03:10, Anton Gilb wrote: > Hi everyone, I'm a novice student struggling through my first python course. > Currently stuck on how to tackle this exercise. Any input would be > appreciated, and I know you guys can not just give me the answer, I'm just > looking for help to underst

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Walter Prins
Hi, On 6 November 2013 08:58, Mark Lawrence wrote: > On 06/11/2013 02:19, Steven D'Aprano wrote: > >> On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: >> >>> I need help in modifying my program. Right now it looks as follows: >>> >> [snip code] >> >>> Can someone help me in impro

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Alan Gauld
On 06/11/13 02:19, Steven D'Aprano wrote: Yes! The first thing to do is get rid of the unnecessary class. This is not Java where you have to write classes for everything. From the sample code that you show below, using OOP here accomplishes nothing except making the code more complicated and les

Re: [Tutor] Creating class / OOP structure

2013-11-06 Thread Mark Lawrence
On 06/11/2013 02:19, Steven D'Aprano wrote: On Tue, Nov 05, 2013 at 03:55:05PM -0800, Johan Martinez wrote: I need help in modifying my program. Right now it looks as follows: [snip code] Can someone help me in improving my code? Yes! The first thing to do is get rid of the unnecessary class

[Tutor] Can someone please help me with this?

2013-11-06 Thread Anton Gilb
Hi everyone, I'm a novice student struggling through my first python course. Currently stuck on how to tackle this exercise. Any input would be appreciated, and I know you guys can not just give me the answer, I'm just looking for help to understand how to work through this. This is the exercise: