Re: [Tutor] Not workin!

2009-09-30 Thread Brett Wilkins
On 30/09/2009, at 10:44 AM, Luke Paireepinart wrote: On Tue, Sep 29, 2009 at 11:40 PM, Corey Richardson wrote: I got suggested to use this format for my code, as it was shorter and prettier. But It dun work! if wellness != ["Well","Fine","Good", "OK", "ok", "Ok", "Great", "Awesome", "Ep

Re: [Tutor] invalid syntax (reply)

2009-09-24 Thread Brett Wilkins
if wellness != "Good": elif wellness != "Well": elif wellness != "Fine": print "Oh, I'm sorry you are not feeling well. I guessed correct, right?" I think the problem is the elif's and the indents... elif is 'else if', and should be at the same indentation level as the prev

Re: [Tutor] how to remove first '/'

2009-08-26 Thread Brett Wilkins
I would say the best way would be to use lstrip... path='/path/to/file' stripped_path = path.lstrip('/') Cheers --Brett > Hello, > I want to strip the first '/' from the following: > > '/path/to/file' > > How can I do this? > > Dave > ___ > Tutor mailli

Re: [Tutor] UNSUBSCRIPTABLE?

2009-03-08 Thread Brett Wilkins
Your problem: def main(): DisplayInstruct() puter, human = Pieces() turn = X board = NewBoard<<<--This line DisplayBoard(board) if you read my email before, I described this to you :) put brackets on the end of NewBoard (so NewBoard() ) and this should work. Cheers WM.

Re: [Tutor] UNSUBSCRIPTABLE?

2009-03-08 Thread Brett Wilkins
Found this book at the local library... If you're doing the TicTacToe game in chapter 6, then have a look at the main function (def main: ) and find the line that says board = new_board() This is likely where your troubles lie... Cheers --Brett John Fouhy wrote: 2009/3/9 WM. : Th

Re: [Tutor] UNSUBSCRIPTABLE?

2009-03-08 Thread Brett Wilkins
Given that board is a function then I believe that it is likely you're either (a) doing something wrong beforehand, or (b) if board is a function that generates the Tic Tac Toe board, then the syntax you more likely need is board()[number] , but I can't be completely certain. when I say doing

Re: [Tutor] cube root

2009-01-19 Thread Brett Wilkins
rence. Cheers --Brett Kent Johnson wrote: > On Mon, Jan 19, 2009 at 6:11 AM, Brett Wilkins wrote: >> The only language I've run into so far (I haven't used many, mind) that >> doesn't have this issue is Scheme :) > > It doesn't have an issue with cube

Re: [Tutor] cube root

2009-01-19 Thread Brett Wilkins
available to me currently. Alan Gauld wrote: > > "Brett Wilkins" wrote > >> What you're running into here is the limited accuracy of floating point >> values... You'll likely find this happens a lot in python.. CPython, >> at least. > > In fact

Re: [Tutor] cube root

2009-01-18 Thread Brett Wilkins
Hey Colin, What you're running into here is the limited accuracy of floating point values... You'll likely find this happens a lot in python.. CPython, at least. (I know, as I do) I'm not sure, as I've never used it... but perhaps Numeric/Numpy handle this kinda stuff better (for accuracy's sake)

Re: [Tutor] Reading List from File

2008-07-31 Thread Brett Wilkins
This is what I'd use... But it'd also be rather easy with regex... Oh well. Here: >>> f = open('intext', 'r') >>> foo = f.readline().strip().replace('"','').split(',') >>> foo ['aaa', 'bbb', 'ccc'] Cheers On 1/08/2008, at 1:49 AM, [EMAIL PROTECTED] wrote: If your list is in the format: aaa,

Re: [Tutor] Running shell command

2008-05-30 Thread Brett Wilkins
Just as a side point, wouldn't the easiest way be to run the script under sudo? It's safer imho than putting the sudo password in programmatically... Cheers --Brett On 30/05/2008, at 7:21 PM, Alan Gauld wrote: "Ricardo DueƱas Parada" <[EMAIL PROTECTED]> wrote When I run the command os.syste

Re: [Tutor] hypotenuse

2008-03-13 Thread Brett Wilkins
import math math.sqrt(intNumber) Cheers, Brett > I am in an early lesson in "A Byte of Python." Instead of writing a > program > to find the area of a rectangle I thought it would be useful to write a > program to determine the length of the diagonal of a "golden rectangle", > which would of

Re: [Tutor] Python oddity

2008-02-28 Thread Brett Wilkins
Cheers, I actually forgot about the whole shallow-copy thing, and deepcopy(). I'm only new to the language myself, I just remembered about the slice copy and thought to mention it. Luke Paireepinart wrote: > Brett Wilkins wrote: >> As everybody else has told you, assigning bb = aa

Re: [Tutor] Python oddity

2008-02-28 Thread Brett Wilkins
As everybody else has told you, assigning bb = aa just gives bb the reference to the same object that aa has. Unless I missed something, then nobody's actually mentioned how to make this not happen... and it's actually rather easy... instead of bb = aa, do this: bb = aa[:] Looks like a splice, a

[Tutor] Error checking and such in a console "guess my number" game

2008-01-07 Thread Brett Wilkins
ot;: break elif stop.lower() == "stop": exit() What I want the break statement to do here is exit the while loop isn't currently in, but it just seems to break the current if decision, making it rather redundant. A little help with this in particular would be much app