Re: [Tutor] Creating a list from other lists

2012-10-23 Thread Walter Prins
>> It's an HTML post. > > Not according to the version of Thunderbird I am using, which shows it > as a plain text email. > > I suspect that the HTML attachment may be invalid HTML, understandable > by Gmail and possibly nothing else. Typical of Google :( Looking at the email source it clearly sho

Re: [Tutor] Creating a list from other lists

2012-10-23 Thread Steven D'Aprano
On 23/10/12 19:51, Walter Prins wrote: It's an HTML post. Not according to the version of Thunderbird I am using, which shows it as a plain text email. I suspect that the HTML attachment may be invalid HTML, understandable by Gmail and possibly nothing else. Typical of Google :( Looking at t

Re: [Tutor] Which is better Practice and why

2012-10-23 Thread Steven D'Aprano
On 23/10/12 12:53, Devin Jeanpierre wrote: On Mon, Oct 22, 2012 at 8:54 PM, Steven D'Aprano wrote: package.__main__.py is designed to be run as a script, and not to be imported. But that doesn't mean that there's no good purpose for importing it. If your package is non-trivial, you ought to h

Re: [Tutor] Creating a list from other lists

2012-10-23 Thread eryksun
On Tue, Oct 23, 2012 at 4:51 AM, Walter Prins wrote: > > Looking at the email source it clearly shows as being mimetype > "multipart" with both a plaintext and HTML part. I don't think you > can much criticise GMail for interpreting and attempting to render an > HTML email as HTML. The biggest c

Re: [Tutor] Which is better Practice and why

2012-10-23 Thread Devin Jeanpierre
On Tue, Oct 23, 2012 at 5:59 AM, Steven D'Aprano wrote: > I think you'll find that you're wrong there :) Oops. >> If I want to test something, I put it in another file. > Yes. And how do you import the __main__.py module to test it, without > it executing? How do you test the body of code in th

Re: [Tutor] Which is better Practice and why

2012-10-23 Thread Oscar Benjamin
On 23 October 2012 02:17, Devin Jeanpierre wrote: > On Mon, Oct 22, 2012 at 8:42 PM, Steven D'Aprano wrote: >> If you do that, and the module directly or indirectly imports itself >> while it is running as a script, you may run into trouble. But writing >> a dual-purpose module that is usable as

Re: [Tutor] Iterators, example (need help)

2012-10-23 Thread eryksun
On Mon, Oct 22, 2012 at 6:30 PM, Bryan A. Zimmer wrote: > > ignore1=''' > > This program works to do what I set out to do as a first step > BAZ 10/19/2012 > > ''' If this isn't meant to be a module docstring, leave it where it is, but remove the assignment to ignore1. Unassigned triple-quoted str

Re: [Tutor] iterators, need help

2012-10-23 Thread Bryan A. Zimmer
I just wanted to say thanlk you to those who took the time to answer my request for help. It is very much appreciated. Bryan A Zimmer ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailm

[Tutor] blackJack problem

2012-10-23 Thread Matthew Dalrymple
player1.py > http://pastebin.com/jzv1Hhs1blackjack.py > http://pastebin.com/Vj3sp3Ca ok the problem im having is with the GetBet function...i need it so you start with 1000 it will bet 5 everytime...if i win it adds 5 if i lose it subtracts 5 if we tie nothing changes. I think this i

Re: [Tutor] blackJack problem

2012-10-23 Thread Alan Gauld
Matthew Dalrymple writes: > I thought by having a value outside > of the functions made the value global. Not quite. To change the global value in a function you also need to declare it as global inside the function. Otherwise it will create a new local variable that has no effect on the global

[Tutor] Retrieving numbers from a text

2012-10-23 Thread Rufino Beniga
*Problem*: Analyze a chaotic one-dimensional map: Write a program OneDMapAnalyze.py that reads the data in OneDMap.txt. Calculate the mean value of the iterates, printing the result to the terminal; again annotate the output so that it is understandable. Determine the fraction of iterates that have

Re: [Tutor] Retrieving numbers from a text

2012-10-23 Thread Alan Gauld
On 23/10/12 23:45, Rufino Beniga wrote: First, you realize I hope that we don;t do homework for you but we will try to help steer you the right way... So the simple answer is... > -- > tell me i can't do it, then i'll prove you wrong! OK, You can't do it. Is that enough? I thought not, rea

Re: [Tutor] Retrieving numbers from a text

2012-10-23 Thread Steven D'Aprano
On 24/10/12 09:45, Rufino Beniga wrote: My problem is, I don't know how to get ONLY the numbers from the OneDMap.txt file. Also, assuming that I am able to do just that, how would I get them into an array? What we need to see is typical contents of your file. I expect it looks something like

[Tutor] Strings.

2012-10-23 Thread Nitin Ainani
Dear Sir/Madam, I am new to python I have a question. It is as follows: Suppose *s* is a variable and *s* stores empty string s="" Now if we write following statement print(s[0]) # it gives error print(s[0:])# it does not give error print (s[13:13]) # this too does not give erro

Re: [Tutor] Doubt!

2012-10-23 Thread Dave Angel
On 10/23/2012 07:14 PM, Nitin Ainani wrote: > Dear Sir/Madam, > > I am new to python I have a question. It is as follows: > > Suppose *s* is a variable and *s* stores empty string > > s="" > Now if we write following statement > > > print(s[0]) # it gives error There is no 0th character, so

Re: [Tutor] Doubt!

2012-10-23 Thread Steven D'Aprano
On 24/10/12 10:14, Nitin Ainani wrote: Dear Sir/Madam, I am new to python I have a question. It is as follows: Suppose *s* is a variable and *s* stores empty string s="" Now if we write following statement print(s[0]) # it gives error print(s[0:])# it does not give error why?

Re: [Tutor] Doubt!

2012-10-23 Thread emile
On 10/23/2012 04:14 PM, Nitin Ainani wrote: Dear Sir/Madam, I am new to python I have a question. It is as follows: Suppose *s* is a variable and *s* stores empty string s="" Now if we write following statement print(s[0]) # it gives error print(s[0:])# it does not give error wh

Re: [Tutor] Strings.

2012-10-23 Thread Alexander
On Tue, Oct 23, 2012 at 7:24 PM, Nitin Ainani wrote: > Dear Sir/Madam, > > I am new to python I have a question. It is as follows: > > Suppose s is a variable and s stores empty string > > emptyString = "" #consider the string to be non-empty, that is, let's say 13 characters long (the number you

Re: [Tutor] Strings.

2012-10-23 Thread Dave Angel
On 10/23/2012 07:48 PM, Alexander wrote: > On Tue, Oct 23, 2012 at 7:24 PM, Nitin Ainani wrote: >> Dear Sir/Madam, >> >> I am new to python I have a question. It is as follows: >> >> Suppose s is a variable and s stores empty string >> >> emptyString = "" > #consider the string to be non-empty, t

Re: [Tutor] Strings.

2012-10-23 Thread Mark Lawrence
On 24/10/2012 00:24, Nitin Ainani wrote: Dear Sir/Madam, I am new to python I have a question. It is as follows: Suppose *s* is a variable and *s* stores empty string Pythonistas prefer the use of name and not variable. s="" Now if we write following statement print(s[0]) # it give

Re: [Tutor] blackJack problem

2012-10-23 Thread Matthew D
> To: tutor@python.org > From: alan.ga...@btinternet.com > Date: Tue, 23 Oct 2012 23:46:23 +0100 > Subject: Re: [Tutor] blackJack problem > > Matthew Dalrymple writes: > > > I thought by having a value outside > > of the functions made the value global. > ok...is there an easier way to write

Re: [Tutor] blackJack problem

2012-10-23 Thread Alan Gauld
On 24/10/12 01:00, Matthew D wrote: > > I thought by having a value outside > > of the functions made the value global. > ok...is there an easier way to write this? the reason i was calling that global value the same as the currentBet is because i need to add that value to 5... You need to

Re: [Tutor] blackJack problem

2012-10-23 Thread Matthew D
Thanks Alan Gauld for your help. After taking a little break and coming back it all seemed to make sense...i understand why there is gonna be some really weird outputs to the interchanging of the player1.py files...that really could get interesting LOL...I seemed to have got the program running

Re: [Tutor] blackJack problem

2012-10-23 Thread wrw
On Oct 23, 2012, at 11:01 PM, Matthew D wrote: > Thanks Alan Gauld for your help. After taking a little break and coming back > it all seemed to make sense...i understand why there is gonna be some really > weird outputs to the interchanging of the player1.py files...that really > could get in

Re: [Tutor] blackJack problem

2012-10-23 Thread Mark Lawrence
On 24/10/2012 04:01, Matthew D wrote: big top post snipped. Any chance of your prof teaching you *NOT* to top post and to use plain English while you're at it? -- Cheers. Mark Lawrence. ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] blackJack problem

2012-10-23 Thread Matthew D
> To: tutor@python.org > From: breamore...@yahoo.co.uk > Date: Wed, 24 Oct 2012 04:33:14 +0100 > Subject: Re: [Tutor] blackJack problem > > On 24/10/2012 04:01, Matthew D wrote: > > > > big top post snipped. > > > > wow was this really necessary? no need to be an ass... > Any chance of your

Re: [Tutor] blackJack problem

2012-10-23 Thread Mark Lawrence
On 24/10/2012 04:36, Matthew D wrote: > To: tutor@python.org From: breamore...@yahoo.co.uk Date: Wed, 24 Oct 2012 04:33:14 +0100 Subject: Re: [Tutor] blackJack problem On 24/10/2012 04:01, Matthew D wrote: big top post snipped. wow was this really necessary? no need to be an ass..