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
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
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
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.
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
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
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
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
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)
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,
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
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
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
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
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
15 matches
Mail list logo