Re: [Tutor] Sequences of letter

2010-04-12 Thread Rich Lovely
On 13 April 2010 01:07, Alan Gauld wrote: > > "Steven D'Aprano" wrote > > import itertools > for x in itertools.product('abc', 'abc', 'abc'): >> >> If you don't like the repeated 'abc' in the call to product(), it can be >> written as itertools.product(*['ab']*3) instead. > > Nope, I thin

Re: [Tutor] Sequences of letter

2010-04-12 Thread Alan Gauld
"Steven D'Aprano" wrote import itertools for x in itertools.product('abc', 'abc', 'abc'): If you don't like the repeated 'abc' in the call to product(), it can be written as itertools.product(*['ab']*3) instead. Nope, I think the repeated string is much clearer, and thus better, than the c

Re: [Tutor] Sequences of letter

2010-04-12 Thread Steven D'Aprano
On Tue, 13 Apr 2010 02:46:39 am Dave Angel wrote: > Or more readably: > > from string import lowercase as letters > for c1 in letters: > for c2 in letters: > for c3 in letters: > print c1+c2+c3 Here's another solution, for those using Python 2.6 or better: >>> impo

Re: [Tutor] Sequences of letter

2010-04-12 Thread Dave Angel
Or more readably: from string import lowercase as letters for c1 in letters: for c2 in letters: for c3 in letters: print c1+c2+c3 Yashwin Kanchan wrote: Hi Juan Hope you have got the correct picture now... I just wanted to show you another way of doing the above th

Re: [Tutor] Sequences of letter

2010-04-12 Thread Yashwin Kanchan
Hi Juan Hope you have got the correct picture now... I just wanted to show you another way of doing the above thing in just 4 lines. for i in range(65,91): for j in range(65,91): for k in range(65,91): print chr(i)+chr(j)+chr(k), On 12 April 2010 06:12, Juan Jose Del Toro wrote: > Dear List;

Re: [Tutor] Sequences of letter

2010-04-12 Thread spir ☣
On Mon, 12 Apr 2010 00:12:59 -0500 Juan Jose Del Toro wrote: > Dear List; > > I have embarked myself into learning Python, I have no programming > background other than some Shell scripts and modifying some programs in > Basic and PHP, but now I want to be able to program. > > I have been readi

Re: [Tutor] Sequences of letter

2010-04-12 Thread Alan Gauld
"Juan Jose Del Toro" wrote So far this is what I have: letras = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","z"] Because a string is a sequence of letters you could have saved some typing by just doing: letras = "abcdefghijklmnopqrstuvwxyz"

Re: [Tutor] Sequences of letter

2010-04-12 Thread Stefan Behnel
Juan Jose Del Toro, 12.04.2010 07:12: I wan to write a program that could print out the suquence of letters from "aaa" all the way to "zzz" like this: aaa aab aac ... zzx zzy zzz So far this is what I have: letras = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t

Re: [Tutor] Sequences of letter

2010-04-11 Thread Patrick Sabin
So far this is what I have: letras = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","z"] letra1 = 0 letra2 = 0 letra3 = 0 for i in letras: for j in letras: for k in letras: print letras[letra1]+letras[letra2]+letras[letra3

Re: [Tutor] Sequences of letter

2010-04-11 Thread Mark Tolonen
"Juan Jose Del Toro" wrote in message news:s2i9b44710e1004112212zdf0b052fxe647ba6bb9671...@mail.gmail.com... Dear List; I have embarked myself into learning Python, I have no programming background other than some Shell scripts and modifying some programs in Basic and PHP, but now I want to b

[Tutor] Sequences of letter

2010-04-11 Thread Juan Jose Del Toro
Dear List; I have embarked myself into learning Python, I have no programming background other than some Shell scripts and modifying some programs in Basic and PHP, but now I want to be able to program. I have been reading Alan Gauld's Tutor which has been very useful and I've also been watching