Re: [Tutor] Invalid Token Problem

2012-07-20 Thread Alan Gauld
On 20/07/12 11:31, Ross Wilson wrote: But what is the difference if I write incorrect code and *execute* it or write an the same code in a string and *eval()* it. The result is the same whether eval() is used or not. Same result, same risk. No, a much bigger risk because you can manipulate

Re: [Tutor] Invalid Token Problem

2012-07-20 Thread Ross Wilson
On 20/07/12 17:25, Alan Gauld wrote: On 20/07/12 02:01, Ross Wilson wrote: More specifically, eval() is dangerous if you try to evaluate a string supplied by someone else. You really can't predict what will happen. It really doesn't matter who provides the string, Python and eval() don't car

Re: [Tutor] Invalid Token Problem

2012-07-20 Thread Alan Gauld
On 20/07/12 02:01, Ross Wilson wrote: More specifically, eval() is dangerous if you try to evaluate a string supplied by someone else. You really can't predict what will happen. It really doesn't matter who provides the string, Python and eval() don't care. They will behave just as dangerous

Re: [Tutor] Invalid Token Problem

2012-07-19 Thread Ross Wilson
On 20/07/12 10:45, Dave Angel wrote: On 07/19/2012 08:36 PM, Osemeka Osuagwu wrote: ... 99 ninety nine 100 onehundred 101 one hundred and one 102 one hundred and two 103 one hundred and three 104 one hundred and four 105 one hundred and five 106 one hundred and six 107 one hundred and seven 108

Re: [Tutor] Invalid Token Problem

2012-07-19 Thread Dave Angel
On 07/19/2012 08:36 PM, Osemeka Osuagwu wrote: > ... > 99 ninety nine > 100 onehundred > 101 one hundred and one > 102 one hundred and two > 103 one hundred and three > 104 one hundred and four > 105 one hundred and five > 106 one hundred and six > 107 one hundred and seven > 108 > > Traceback (mos

[Tutor] Invalid Token Problem

2012-07-19 Thread Osemeka Osuagwu
Hi folks, I've been trying to convert numbers from digits to words, I wrote the following code; units = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] teens = ['eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'] tens = [