[Tutor] why do i get None as output

2010-09-05 Thread Roelof Wobben
Hello, I have this programm: def encapsulate(val, seq): if type(seq) == type(""): return str(val) if type(seq) == type([]): return [val] return (val,) def insert_in_middle(val, seq): middle = len(seq)/2 return seq[:middle] + encapsulate(val, seq) +

Re: [Tutor] for loop results into list

2010-09-05 Thread Micheal Beatty
On 09/05/2010 03:48 PM, Evert Rol wrote: On 5 Sep 2010, at 22:31 , Micheal Beatty wrote: On 09/05/2010 03:16 PM, Evert Rol wrote: I'm having a little problem figuring out how to accomplish this simple task. I'd like to take a list of 6 numbers and add every permutation of those numbers in g

Re: [Tutor] for loop results into list

2010-09-05 Thread Evert Rol
On 5 Sep 2010, at 22:31 , Micheal Beatty wrote: > On 09/05/2010 03:16 PM, Evert Rol wrote: >>> I'm having a little problem figuring out how to accomplish this simple >>> task. I'd like to take a list of 6 numbers and add every permutation of >>> those numbers in groups of four. For

Re: [Tutor] for loop results into list

2010-09-05 Thread Micheal Beatty
On 09/05/2010 03:16 PM, Evert Rol wrote: I'm having a little problem figuring out how to accomplish this simple task. I'd like to take a list of 6 numbers and add every permutation of those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + 1 + 1 +1 then 1 + 1 + 1 +2 etc. unt

Re: [Tutor] for loop results into list

2010-09-05 Thread Evert Rol
> > I'm having a little problem figuring out how to accomplish this simple > task. I'd like to take a list of 6 numbers and add every permutation of > those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + > 1 + 1 +1 then 1 + 1 + 1 +2 etc. until reaching 6 + 6

Re: [Tutor] Creating custom GUI elements

2010-09-05 Thread aug dawg
Okay, thanks everyone for all the help! On Sun, Sep 5, 2010 at 3:40 PM, David Hutto wrote: > On Sun, Sep 5, 2010 at 3:32 PM, aug dawg wrote: > > I took a look at Blender, but it all seemed very overwhelming. If I > wanted > > to, could I code all of the blocks? I want to have some functionalit

Re: [Tutor] for loop results into list

2010-09-05 Thread Micheal Beatty
On 09/05/2010 02:22 PM, Evert Rol wrote: I'm having a little problem figuring out how to accomplish this simple task. I'd like to take a list of 6 numbers and add every permutation of those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + 1 + 1 +1 then 1 + 1 + 1 +2 etc. unt

[Tutor] Fwd: for loop results into list

2010-09-05 Thread Mike Beatty
Should have sent this to the list too -- Forwarded message -- From: Micheal Beatty Date: Sun, Sep 5, 2010 at 2:38 PM Subject: Re: [Tutor] for loop results into list To: Andre Engels  On 09/05/2010 02:16 PM, Andre Engels wrote: > > On Sun, Sep 5, 2010 at 8:51 PM, Micheal Beatty

Re: [Tutor] Creating custom GUI elements

2010-09-05 Thread aug dawg
I took a look at Blender, but it all seemed very overwhelming. If I wanted to, could I code all of the blocks? I want to have some functionality for people adding their own bricks and other items. On Sun, Sep 5, 2010 at 2:04 PM, David Hutto wrote: > I'd suggest you take a look at blender. It ha

Re: [Tutor] for loop results into list

2010-09-05 Thread Evert Rol
>>> I'm having a little problem figuring out how to accomplish this simple >>> task. I'd like to take a list of 6 numbers and add every permutation of >>> those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + 1 >>> + 1 +1 then 1 + 1 + 1 +2 etc. until reaching 6 + 6 + 6 + 6. U

Re: [Tutor] for loop results into list

2010-09-05 Thread Andre Engels
On Sun, Sep 5, 2010 at 8:51 PM, Micheal Beatty wrote: >  On 09/05/2010 01:26 PM, Evert Rol wrote: >>> >>> Hello all, >>> >>> I'm having a little problem figuring out how to accomplish this simple >>> task. I'd like to take a list of 6 numbers and add every permutation of >>> those numbers in group

Re: [Tutor] for loop results into list

2010-09-05 Thread Micheal Beatty
On 09/05/2010 01:26 PM, Evert Rol wrote: Hello all, I'm having a little problem figuring out how to accomplish this simple task. I'd like to take a list of 6 numbers and add every permutation of those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + 1 + 1 +1 then 1 + 1 + 1

Re: [Tutor] for loop results into list

2010-09-05 Thread Evert Rol
> Hello all, > > I'm having a little problem figuring out how to accomplish this simple task. > I'd like to take a list of 6 numbers and add every permutation of those > numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + 1 + 1 +1 > then 1 + 1 + 1 +2 etc. until reaching 6 + 6 +

[Tutor] for loop results into list

2010-09-05 Thread Micheal Beatty
Hello all, I'm having a little problem figuring out how to accomplish this simple task. I'd like to take a list of 6 numbers and add every permutation of those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 + 1 + 1 +1 then 1 + 1 + 1 +2 etc. until reaching 6 + 6 + 6 + 6. Usi

Re: [Tutor] Creating custom GUI elements

2010-09-05 Thread David Hutto
I'd suggest you take a look at blender. It has a pretty easy to use game engine with actuators, sensors and controllers, with a Python scripts api. It'll take the time out of going 3-d with pygame, and you can build the custom legos within it as well. ___

Re: [Tutor] Iterating through a list of replacement regex patterns

2010-09-05 Thread David Hutto
On Sat, Sep 4, 2010 at 6:16 AM, Steven D'Aprano wrote: > On Sat, 4 Sep 2010 11:57:00 am David Hutto wrote: >> First of all, I'll respond more thoroughly tomorrow, when I can >> review what you said more clearly, but for now I'll clarify. >> >> Here is the whole code that I'm using: >> >> http://pa

Re: [Tutor] Creating custom GUI elements

2010-09-05 Thread aug dawg
That would work, but I want there to be a palette and then the user can drag the Lego, flip it, and turn it. In order to do this, it would have to be 3D. On Sun, Sep 5, 2010 at 11:32 AM, Che M wrote: > > > > > Would Pygame allow me to code all of the bricks instead of drawing them > out? > > I'

Re: [Tutor] Scrabble Help

2010-09-05 Thread Steven D'Aprano
On Mon, 6 Sep 2010 01:45:30 am William Allison wrote: > I'd like to write a program to help find words for Scrabble but I've > been having trouble > right from the beginning. > > tiles = 'aeirstw' > > dictionary = ['aardvark', 'cat', 'dog', 'taste', 'stare', 'wrist'] > > for word in range(len(dicti

[Tutor] Scrabble Help

2010-09-05 Thread William Allison
I'd like to write a program to help find words for Scrabble but I've been having trouble right from the beginning. tiles = 'aeirstw' dictionary = ['aardvark', 'cat', 'dog', 'taste', 'stare', 'wrist'] for word in range(len(dictionary)): for letter in range(len(dictionary[word])): if d

Re: [Tutor] Creating custom GUI elements

2010-09-05 Thread Che M
> Would Pygame allow me to code all of the bricks instead of drawing them out? I've never used Pygame; I have no idea. What I was suggesting was just getting a picture of a real or Lego-like brick from somewhere and using that image in your program. No drawing required.

Re: [Tutor] (no subject)

2010-09-05 Thread Andre Engels
On Sun, Sep 5, 2010 at 4:17 PM, Roelof Wobben wrote: > I understand the error message. > I follow this example in the book : > http://openbookproject.net/thinkcs/python/english2e/ch11.html > And there element is not defined. It is: for element in nested_num_list: -- André Engels, andreeng..

Re: [Tutor] Creating custom GUI elements

2010-09-05 Thread aug dawg
Would Pygame allow me to code all of the bricks instead of drawing them out? On Sat, Sep 4, 2010 at 10:35 PM, Che M wrote: > > > > How would I go about creating custom GUI elements? For example, > > if I wanted to make a simple LEGO maker app, how would I write the > > code for the bricks so th

Re: [Tutor] (no subject)

2010-09-05 Thread Roelof Wobben
> From: st...@pearwood.info > To: tutor@python.org > Date: Sun, 5 Sep 2010 23:55:32 +1000 > Subject: Re: [Tutor] (no subject) > > On Sun, 5 Sep 2010 11:44:09 pm Roelof Wobben wrote: > > Hello, > > > > I have made this program as solution to a exercise from thinking like > > a computer scienti

Re: [Tutor] (no subject)

2010-09-05 Thread Steven D'Aprano
On Sun, 5 Sep 2010 11:44:09 pm Roelof Wobben wrote: > Hello, > > I have made this program as solution to a exercise from thinking like > a computer scientist. [...] > But now Im getting this error message : > > Traceback (most recent call last): > File "C:\Users\wobben\workspace\oefeningen\src\test

[Tutor] (no subject)

2010-09-05 Thread Roelof Wobben
Hello, I have made this program as solution to a exercise from thinking like a computer scientist. def encapsulate(val, seq): if type(seq) == type(""): return str(val) if type(seq) == type([]): return [val] return (val,) def insert_in_middle(val, seq): middle = len(seq)/2 return seq[:

Re: [Tutor] Giving a name to a function and calling it, rather than calling the function directly

2010-09-05 Thread lists
>  On 9/4/2010 10:14 AM, lists wrote: >> >> Hi folks, >> >> I'm new to Python, I'm working my way through some intro books, and I >> have a question that I wonder if someone could help me with please? >> >> This is my attempt at solving an exercise where the program is >> supposed to flip a coin 10

Re: [Tutor] iterating over less than a full list

2010-09-05 Thread Dave Angel
Bill Allen wrote: Thanks to everyone who replied. Some of the methods presented where some I had thought of, others were new to me. Particularly, I did not realize I could apply a slice to a list. The for x in some_stuff[:value] form worked very well for my purposes. I can also see I need