Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Ken G.
On 11/03/2014 12:37 AM, Danny Yoo wrote: I use exec to jump to another program within the same directory, such as: execfile("BloodPressure02Sorting.py") and let the program terminate there. Should I do it differently or are you talking about a different horse? This is related. Rather than u

Re: [Tutor] Some shameless self promotion

2014-11-03 Thread Albert-Jan Roskam
- Original Message - > From: Alan Gauld > To: tutor@python.org > Cc: > Sent: Monday, November 3, 2014 2:22 AM > Subject: [Tutor] Some shameless self promotion > > For anyone who might be interested > > http://www.amazon.com/Python-Projects-Laura-Cassell/dp/111890866X > > A book aime

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Albert-Jan Roskam
> >Real question is what you're trying to do. eval() and exec() are to be >avoided if possible, so the solutions are not necessarily the easiest. I sometimes do something like ifelse = "'teddybear' if bmi > 30 else 'skinny'" weightcats = [eval(ifelse) for bmi in bmis] Would this also be a *b

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Alan Gauld
On 03/11/14 17:33, Albert-Jan Roskam wrote: I sometimes do something like ifelse = "'teddybear' if bmi > 30 else 'skinny'" weightcats = [eval(ifelse) for bmi in bmis] Would this also be a *bad* use of eval? It can be avoided, but this is so concise. eval etc are worst where the code to be ev

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Danny Yoo
On Mon Nov 03 2014 at 10:04:41 AM Alan Gauld wrote: > On 03/11/14 17:33, Albert-Jan Roskam wrote: > > > I sometimes do something like > > ifelse = "'teddybear' if bmi > 30 else 'skinny'" > > weightcats = [eval(ifelse) for bmi in bmis] > > > > Would this also be a *bad* use of eval? It can be avoi

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Danny Yoo
On Mon Nov 03 2014 at 10:48:29 AM Danny Yoo wrote: > On Mon Nov 03 2014 at 10:04:41 AM Alan Gauld > wrote: > >> On 03/11/14 17:33, Albert-Jan Roskam wrote: >> >> > I sometimes do something like >> > ifelse = "'teddybear' if bmi > 30 else 'skinny'" >> > weightcats = [eval(ifelse) for bmi in bmis]

[Tutor] Flow of execution of execution

2014-11-03 Thread William Becerra
hey, I'm new to programming. running Python 2.7.8 on windows 8 OS Im on chapter 6 of a book called 'How to Think Like a Computer Scientist-Learning with Python' here is the code: def printMultiples(n, high): i = 1 while i<=high: print n*i, "\t", i = i + 1 print def multi

Re: [Tutor] Flow of execution of execution

2014-11-03 Thread Alan Gauld
On 03/11/14 18:04, William Becerra wrote: def printMultiples(n, high): i = 1 while i<=high: print n*i, "\t", i = i + 1 print def multipleTable(high): i = 1 while i<=high: printMultiples(i, i) i = i + 1 print print multipleTa

[Tutor] Python help

2014-11-03 Thread Juwel Williams
Good Day, I am in a python class at my school. I am very confused, he gives us assignments but I am not sure how to attempt it. I am confused about tuples, lists and dictionaries. Now he has moved on to class and modules. Can you assist me please. He has given us a module to go by. It says d

Re: [Tutor] Python help

2014-11-03 Thread Alan Gauld
On 03/11/14 20:26, Juwel Williams wrote: I am confused about tuples, lists and dictionaries. The more specific your question the easier it is for us to answer. What exactly is confusing you about them? What they are? How to use them? The syntax? Now he has moved on to class and modules. Can

Re: [Tutor] Some shameless self promotion

2014-11-03 Thread memilanuk
On 11/02/2014 05:22 PM, Alan Gauld wrote: For anyone who might be interested http://www.amazon.com/Python-Projects-Laura-Cassell/dp/111890866X A book aimed at those who have just finished their first python tutorial and are wondering what to do next... Do you know if there are any plans for

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Steven D'Aprano
On Sun, Nov 02, 2014 at 06:23:12PM -0500, Ken G. wrote: > I use exec to jump to another program within the > same directory, such as: > > execfile("BloodPressure02Sorting.py") > > and let the program terminate there. Should I do > it differently or are you talking about a different > horse? Tha

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Steven D'Aprano
On Mon, Nov 03, 2014 at 09:33:18AM -0800, Albert-Jan Roskam wrote: > >Real question is what you're trying to do. eval() and exec() are to be > >avoided if possible, so the solutions are not necessarily the easiest. > > I sometimes do something like > ifelse = "'teddybear' if bmi > 30 else 'skin

Re: [Tutor] Newbie Trouble Processing SRT Strings In Text File

2014-11-03 Thread Dave Angel
Please evaluate your email program. Some of your newline s are being lost in the paste into your email. Matt Varner Wrote in message: > TL:DR - Skip to "My Script: "subtrans.py" > > > > Optional Links to (perhaps) Helpful Images: > 1. The SRT download button: > http://i70.photobucket.com/alb

Re: [Tutor] Fwd: Re: Simple guessing game - need help with the math

2014-11-03 Thread Dave Angel
You're still using html mail, and still top-posting. > > But my curiosity is still begging me for an answer regarding my original > approach. Is there a way to manage the functionality of be round function > such that it does not strip any data to the right of the decimal point? That's the w

Re: [Tutor] Flow of execution of execution

2014-11-03 Thread William Becerra
Thank you guys On Mon, Nov 3, 2014 at 11:26 PM, Alan Gauld wrote: > On 03/11/14 18:04, William Becerra wrote: > > def printMultiples(n, high): >> i = 1 >> while i<=high: >> print n*i, "\t", >> i = i + 1 >> print >> > > def multipleTable(high): >> i = 1 >>

Re: [Tutor] Some shameless self promotion

2014-11-03 Thread Alan Gauld
On 04/11/14 00:55, memilanuk wrote: On 11/02/2014 05:22 PM, Alan Gauld wrote: For anyone who might be interested http://www.amazon.com/Python-Projects-Laura-Cassell/dp/111890866X A book aimed at those who have just finished their first python tutorial and are wondering what to do next... Do