Re: [Tutor] Projects (fwd)

2008-01-25 Thread Ricardo Aráoz
Tiger12506 wrote: >> Nope, if you read the code you'll see the only mapping done is up to 20 >> and then by tens up to 100, that's all. >> The same code could be used with a list, you'd only have to change the >> exception name. > > I see. There were "..." in between each of the tens entries which

Re: [Tutor] Projects (fwd)

2008-01-24 Thread Tiger12506
> Nope, if you read the code you'll see the only mapping done is up to 20 > and then by tens up to 100, that's all. > The same code could be used with a list, you'd only have to change the > exception name. I see. There were "..." in between each of the tens entries which I took to mean that "big

Re: [Tutor] Projects (fwd)

2008-01-24 Thread Ricardo Aráoz
Tiger12506 wrote: >> Isn't dictionary access faster than list access? Why are three lists >> 'much more efficient'? > > Oh no, no, no. Dictionaries are faster when you are *searching through* for > a particular value. If you already know the index of the item in the list, > lists are much faste

Re: [Tutor] Projects (fwd)

2008-01-23 Thread bob gailer
Danny Yoo wrote: > [snip] > First, it ignores zero, which is a cardinal sin. Or is it an ordinal sin? [snip] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Projects (fwd)

2008-01-23 Thread John Fouhy
On 24/01/2008, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > Isn't dictionary access faster than list access? Why are three lists > 'much more efficient'? Well, not necessarily. If you want a dictionary, you could use a list of tuples: myDict = [('a', 'one'), ('b', 'two), ('c', 'three')] Then you

Re: [Tutor] Projects (fwd)

2008-01-23 Thread Tiger12506
> Isn't dictionary access faster than list access? Why are three lists > 'much more efficient'? Oh no, no, no. Dictionaries are faster when you are *searching through* for a particular value. If you already know the index of the item in the list, lists are much faster. Dictionaries are hash ba

Re: [Tutor] Projects (fwd)

2008-01-23 Thread Tiger12506
> This could be written much more efficiently. It can be done with only > these > lists~ > ones = > ['zero','one','two','three','four','five','six','seven','eight','nine'] > teens = > ['ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen'] What is it

Re: [Tutor] Projects (fwd)

2008-01-23 Thread Ricardo Aráoz
Tiger12506 wrote: >> up to a thousand (not tested) >> >> words = {0:'zero', 1:'one', 2:'two', 3:'three', ... , 10:'ten', >> 11:'eleven', 12:'twelve', ..., 19:'nineteen', >> 20:'twenty', , 90:'ninety', 100:'one hundred' } >> def digitToString(n) : >>try : >>retStr = words[n]

Re: [Tutor] Projects (fwd)

2008-01-23 Thread Tiger12506
> up to a thousand (not tested) > > words = {0:'zero', 1:'one', 2:'two', 3:'three', ... , 10:'ten', > 11:'eleven', 12:'twelve', ..., 19:'nineteen', > 20:'twenty', , 90:'ninety', 100:'one hundred' } > def digitToString(n) : >try : >retStr = words[n] >except KeyError : >

Re: [Tutor] Projects (fwd)

2008-01-23 Thread Ricardo Aráoz
Danny Yoo wrote: > Hi Jason, > > > Looking back at that Java code: > > > static String convertDigitToEnglish(int d) { > switch ( d ) > { >case 1: return "one"; >case 2: return "two"; >case 3

Re: [Tutor] Projects (fwd)

2008-01-23 Thread Danny Yoo
Hi Jason, Looking back at that Java code: static String convertDigitToEnglish(int d) { switch ( d ) { case 1: return "one"; case 2: return "two"; case 3: return "three"; case 4: retu

Re: [Tutor] Projects

2008-01-23 Thread Kent Johnson
Terry Carroll wrote: > I'm no Java expert, but isn't Java's Map more or less equivalent to > Python's dictionary? More or less, except Python dicts are about 10x easier to use. Some (overly complicated) examples here: http://personalpages.tds.net/~kent37/stories/00017.html Kent

Re: [Tutor] Projects

2008-01-23 Thread Terry Carroll
On Wed, 23 Jan 2008, Jason Massey wrote: > An example routine to translate a number into [its] english equivalent > was given (again, this is Java): > static String convertDigitToEnglish(int d) { > switch ( d ) > { > > case 1: return "one"; > case 2: return "two"

Re: [Tutor] Projects

2008-01-23 Thread Jason Massey
On Jan 22, 2008 5:10 PM, Damian Archer <[EMAIL PROTECTED]> wrote: > So anyone have any good project ideas, perhaps projects that people have > undertaken before?? > > I'm taking a Java class this semester and our first program is a number translator. Here's the assignment: *Below is a sample

Re: [Tutor] Projects

2008-01-23 Thread Kent Johnson
Damian Archer wrote: > So anyone have any good project ideas, perhaps projects that people have > undertaken before?? This just came up on the list: http://mail.python.org/pipermail/tutor/2008-January/059653.html Kent ___ Tutor maillist - Tutor@pyth

Re: [Tutor] Projects

2008-01-23 Thread Benjamin Eckenfels
On Tue, Jan 22, 2008 at 11:10:18PM +, Damian Archer wrote: >So anyone have any good project ideas, perhaps projects that people >have >undertaken before?? I am in the same situation as you are. What I now did was doing something practical and some fun stuff: such as writing a sta

[Tutor] Projects

2008-01-22 Thread Damian Archer
Guys and Gals, Firstly 'Hi'. So I am new to Python have been learning it for about two months now on and off between working and playing. Its the first language I have tried to learn, I am taking to it quite well and enjoying it, which is always good. The problem I am having is finding proje

Re: [Tutor] projects for beginners

2006-06-19 Thread Mike Hansen
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of josipSent: Monday, June 19, 2006 8:39 AMTo: tutor@python.orgSubject: [Tutor] projects for beginners Hi!   I have read learning python and mede some smaller examples. Now I want to make smoe project

[Tutor] projects for beginners

2006-06-19 Thread josip
Hi!   I have read learning python and mede some smaller examples. Now I want to make smoe project, I'm thinking about text editor. Can someone give me pointers like (where and how to start, etc.)? Or maybe another project suitable for beginners.   Sneak preview the all-new Yahoo.com. It

[Tutor] Tutor projects

2006-04-18 Thread Tino Dai
Hi there, This list is great! I really like the aspect of mentor-mentee relationship. Ok, I have been programming in various languages for many many years, and here is my dilemna. I jump into a huge project such as Zope or Mambo (php side) and spend a couple of weeks on it, get frustrated, and