Tiger12506 wrote:
>> bhaaluu wrote:
>>
>>> Greetings,
>>>
>>> Beautiful! Thank you SO much for all the variations.
>>> I'm so sure I'll have much to learn from them. This
>>> is exactly the kind of stuff I'm currently studying.
>>>
>
> I assume this is for me. Thank you kindly! :-)
>
>
On Thu, 26 Jul 2007, Tiger12506 wrote:
> > But you can call the random functions in your code as often as you want
> > safely.
> >> Perhaps this is a question for the 'language lawyers'?
> >>
> > Not sure what this means.
>
> I believe it means 'those who know the language inside and out' like a
> bhaaluu wrote:
>> Greetings,
>>
>> Beautiful! Thank you SO much for all the variations.
>> I'm so sure I'll have much to learn from them. This
>> is exactly the kind of stuff I'm currently studying.
I assume this is for me. Thank you kindly! :-)
>> I have a question for the list.
>> After I po
> What are typeseq objects. Searching the python site on "typeseq" draws a
> blank.
>
> Dick Moores
I believe that means "sequence" type.
list
tuple
string
are the builtins
I debated with myself about dict, decided that it doesn't fit the
description. That should be all ordered sequence types.
bhaaluu wrote:
> Greetings,
>
> Beautiful! Thank you SO much for all the variations.
> I'm so sure I'll have much to learn from them. This
> is exactly the kind of stuff I'm currently studying.
>
> I have a question for the list.
> After I posted my snippet, I added time to import,
> and a time.sle
At 12:37 PM 7/26/2007, Chris Calloway wrote:
>The *other* form of extended slicing, the one with two colons (and no
>commas) is supported by typeseq objects, though.
What are typeseq objects. Searching the python site on "typeseq" draws a blank.
Dick Moores
_
Greetings,
Beautiful! Thank you SO much for all the variations.
I'm so sure I'll have much to learn from them. This
is exactly the kind of stuff I'm currently studying.
I have a question for the list.
After I posted my snippet, I added time to import,
and a time.sleep(1) line to the code. The rea
> I want to be able to calculate in the program,.. the total score,..
> either at each successive score,... or when they finally get out.
> Not sure how to do that at this point.
You're on the right track. You need an additional variable to hold the
running total.
Alan
_
> When you say nothing happemed I assume you mean the script
> never terminated?
Yes, you are right. it does not terminate and only blocks the screen.
As stated on the site the script needs some special parameters of
Openoffice. Therefore, until I step further, I wrap it around a shell
script
Note that OP constructed his list so that some values are weighted according
to the user's decision (Aggressive or defensive), Just let's not forget that
brilliance~ ;-)
Suggestions below.
> Here is a snippet that might work for one batter:
>
> #!/usr/bin/env python
> # cricket.py
> # 2007-07-2
For anyone who has wondered, how do I learn to write Python like an
expert? What do I read after I finish the tutorial? Check out David
Goodger's "Code Like a Pythonista"
http://python.net/~goodger/projects/pycon/2007/idiomatic/
Kent
___
Tutor maillist
"Tim Michelsen" <[EMAIL PROTECTED]> wrote
>
> Therefore I tried to add this code on top of the original converter:
>
> ###get OOo service started first:
> import os
> code =
> os.system('soffice -headless -accept="socket,port=8100;urp;"')
> when I execute this script nothing happens and I would
"Charles Cuell" <[EMAIL PROTECTED]> wrote
> The one odd thing about Python's slice notation is that the -1 means
> to
> start from the end and work backwards. My first inclination would
> have
> been to assume that -1 means to start at i and go to j by steps
> of -1
> (only nonempy if j < i).
Tim Michelsen wrote:
> Hello,
> I am Python learning in an early stage.
>
> I am currently trying to code a converter for openoffice based on
> PyODConverter:
> http://www.artofsolving.com/opensource/pyodconverter
>
> My goal is to be able to run my script from anywhere in the system (put
> it in
On Thu, Jul 26, 2007 at 01:48:44PM -0600, Eric Brunson wrote:
>
> Do other interpreters work?
>
> Try:
>
> #!/usr/bin/perl
> print "Perl Sucks!!!\n";
>
> or:
Or, try:
#!/usr/bin/env python
Dave
--
Dave Kuhlman
http://www.rexx.com/~dkuhlman
__
Tonu Mikk wrote:
> Luke, thank you for your quick and complete response. Based on your
> suggestions I have already made some progress! BTW, I am so glad that
> I can ask this list my Python questions and get help. I began feeling
> quite stuck and not knowing where to turn for help. So, tha
Hello,
I am Python learning in an early stage.
I am currently trying to code a converter for openoffice based on
PyODConverter:
http://www.artofsolving.com/opensource/pyodconverter
My goal is to be able to run my script from anywhere in the system (put
it in Path) and then convert a file from/t
Bob Gailer wrote:
> Alan Gauld wrote:
>
>> The ref manual ... for extended slicing says:
>>
>> --
>> The semantics for an extended slicing are as follows. The primary must
>> evaluate to a mapping object
>>
> d = {}
>
>> It is indexed with a key that is constructed fr
Greetings,
Disclaimer: This source code is written by a Python Newbie.
Use at your own risk! =)
Here is a snippet that might work for one batter:
#!/usr/bin/env python
# cricket.py
# 2007-07-26
# b h a a l u u at g m a i l dot c o m
import random
def batterUp():
score=[1,2,
Tonu Mikk wrote:
> Eric Brunson wrote:
>
>> Tiger12506 wrote:
>>
>>
Based on your guidance, I figured it out. I need to use a return
statement, which I had not encountered before. Now I wrote my
definitions in this way:
def collided():
if player_x ==
Greg Lindstrom wrote:
> Eric Brunson wrote:
>
>> What does the command "which python" say?
>>
> [EMAIL PROTECTED] ~ $ which python
> /usr/bin/python
>
> HTH,
> --greg
>
>
>
Wow, Gentoo sucks more than I thought. ;-)
I can't think of why that wouldn't work, unless you have some odd,
n
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Alternatively, I prefer something nicer:
import optparse
p = optparse.OptionParser(usage="%prog [options]")
p.add_option("--list1", action="store_const", const=["blue", "red",
"green"], dest="worklist", help="use the first setting")
p.add_option("--li
Ok, I see now. A dictionary using the list elements as values. This will
work for me. Thanks!
jason
On 7/26/07, Eric Brunson <[EMAIL PROTECTED]> wrote:
jason wrote:
> Hello,
>
> I have a situation where I have 2 lists
>
> List1 = ['blue', 'red', green']
> List2 = ['red', 'yellow', 'orange'
Eric Brunson wrote:
>
> What does the command "which python" say?
[EMAIL PROTECTED] ~ $ which python
/usr/bin/python
HTH,
--greg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Alan Gauld wrote:
> The ref manual ... for extended slicing says:
>
> --
> The semantics for an extended slicing are as follows. The primary must
> evaluate to a mapping object
d = {}
> It is indexed with a key that is constructed from the slice list, as follows.
Note that
slic
Kent Johnson wrote:
> AFAIK extended slicing is not supported by any standard Python data
> types, it was added specifically for Numeric.
Numeric *is* responsible for getting *one* of the two forms of extended
slicing added (the one with multiple slices or ellipses separated by
commas) and yes,
On Thu, 26 Jul 2007, jason wrote:
> Hello,
>
> I have a situation where I have 2 lists
>
> List1 = ['blue', 'red', green']
> List2 = ['red', 'yellow', 'orange']
>
> And I would like to pass the list name on the command line like so
>
> ./test.py List1
>
> I know I can get the argument using s
What does the command "which python" say?
Khamid Nurdiev wrote:
> Yes, I have the same problem with running python scripts from console
> in Debian, the line "#! /usr/bin/python" doesn't help. I have to type
> "python script.py" in order to run the script.py file.
>
> On 7/26/07, *Greg Lindstro
jason wrote:
> Hello,
>
> I have a situation where I have 2 lists
>
> List1 = ['blue', 'red', green']
> List2 = ['red', 'yellow', 'orange']
>
> And I would like to pass the list name on the command line like so
>
> ./test.py List1
>
> I know I can get the argument using sys.argv[1]
>
>
Charles Cuell wrote:
> The one odd thing about Python's slice notation is that the -1 means to
> start from the end and work backwards. My first inclination would have
> been to assume that -1 means to start at i and go to j by steps of -1
> (only nonempy if j < i).
A negative step attribute does
Yes, I have the same problem with running python scripts from console in
Debian, the line "#! /usr/bin/python" doesn't help. I have to type "python
script.py" in order to run the script.py file.
On 7/26/07, Greg Lindstrom <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I am running python 2.4.2 on Gentoo
Eric Brunson wrote:
> Tiger12506 wrote:
>
>>> Based on your guidance, I figured it out. I need to use a return
>>> statement, which I had not encountered before. Now I wrote my
>>> definitions in this way:
>>>
>>> def collided():
>>>if player_x == robot_x+0.5 and player_y == robot_y+0.5:
Hello,
I have a situation where I have 2 lists
List1 = ['blue', 'red', green']
List2 = ['red', 'yellow', 'orange']
And I would like to pass the list name on the command line like so
./test.py List1
I know I can get the argument using sys.argv[1]
But how can I then use the values in that list
Hello,
I am running python 2.4.2 on Gentoo Unix and am having problems running
programs. I have a script, hello.py as such:
#! /usr/bin/python
print 'hello, world'
that I save and add executable permission. Then at the prompt I type in..
$ ./hello.py
-bash: ./hello.py: /usr/bin/python: bad in
Tonu Mikk wrote:
> Tiger12506 wrote:
>
>>> Based on your guidance, I figured it out. I need to use a return
>>> statement, which I had not encountered before. Now I wrote my
>>> definitions in this way:
>>>
>>> def collided():
>>>if player_x == robot_x+0.5 and player_y == robot_y+0.5:
>>
Tiger12506 wrote:
>> Based on your guidance, I figured it out. I need to use a return
>> statement, which I had not encountered before. Now I wrote my
>> definitions in this way:
>>
>> def collided():
>>if player_x == robot_x+0.5 and player_y == robot_y+0.5:
>> return True
>>
Gr
Tiger12506 wrote:
>> Based on your guidance, I figured it out. I need to use a return
>> statement, which I had not encountered before. Now I wrote my
>> definitions in this way:
>>
>> def collided():
>>if player_x == robot_x+0.5 and player_y == robot_y+0.5:
>> return True
>>
>
> Based on your guidance, I figured it out. I need to use a return
> statement, which I had not encountered before. Now I wrote my
> definitions in this way:
>
> def collided():
>if player_x == robot_x+0.5 and player_y == robot_y+0.5:
> return True
This could be simplified more.
He
Thanks to everybody that worked to clarify the meaning of [::-1].
My main concern was that it looked like the notation came out of nowhere
and, as such, was inconsistent with the usual slice notation. The
documentation did make it clear, since the full slicing notation is
s[i:j:k], leaving out th
Luke, thank you for your quick and complete response. Based on your
suggestions I have already made some progress! BTW, I am so glad that I
can ask this list my Python questions and get help. I began feeling
quite stuck and not knowing where to turn for help. So, thank you for
the great ser
> -Original Message-
> Subject: Re: [Tutor] while Loop
>
> Oops, didn't notice the uppercase U, thanks Luke.
>
> - Original Message -
> Subject: Re: [Tutor] while Loop
>
>
> >> define it with usedPocketsOne = 192000?
> > no, I said UsedPocketsOne was not defined. Note the
> d
Thanks Kent and Andreas
That is exactly what I needed! Very nice indeed...
jay
On 7/26/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> jay wrote:
> > Hello all,
> >
> > If I import a module, which has a bunch of simple functions in it, is
> > there an easy way to find the direct caller from in
jay wrote:
> Hello all,
>
> If I import a module, which has a bunch of simple functions in it, is
> there an easy way to find the direct caller from inside one of those
> functions? I'm looking to know which script has imported and thus
> called the library function. Thanks!
http://aspn.act
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
sys._getframe.
Andreas
jay wrote:
> Hello all,
>
> If I import a module, which has a bunch of simple functions in it, is
> there an easy way to find the direct caller from inside one of those
> functions? I'm looking to know which script has impor
Hello all,
If I import a module, which has a bunch of simple functions in it, is there
an easy way to find the direct caller from inside one of those functions?
I'm looking to know which script has imported and thus called the library
function. Thanks!
jay
___
The projects are moving along.
I've created a very simplistic cricket game to learn a few things.
The user is asked whether to play Aggressive or Defensively.
Once they pick... a random is picked based on their choice,.. and various
scores happen until they get out.
Ignore the realism at
Alan Gauld wrote:
> "wesley chun" <[EMAIL PROTECTED]> wrote
>
>> when you use the 3rd element, it's called the extended slice syntax.
>
> The ref manual describes use of the third value as simple slicing,
> for extended slicing it says this:
> I've read it three times now and stioll have no id
"Dick Moores" <[EMAIL PROTECTED]> wrote
>>Not sure why it didn't help you Dick, but it led me to:
>>
>>http://docs.python.org/lib/typesseq.html
>>
>
> Alan, I don't see an explanation of [::-1] anywhere in those 3
> links.
> There needs to be a clear description and better examples somewhere
> i
At 12:17 AM 7/26/2007, Alan Gauld wrote:
>"Dick Moores" <[EMAIL PROTECTED]> wrote
>
> >>I could send you a link but I'd just google 'python list slicing' to
> >>find it, so I'll leave that as an exercise for the reader.
> >
> > I don't find Google of help with this. Could someone supply a link?
>
"wesley chun" <[EMAIL PROTECTED]> wrote
> when you use the 3rd element, it's called the extended slice syntax.
The ref manual describes use of the third value as simple slicing,
for extended slicing it says this:
--
The semantics for an extended slicing are as follows. The
"Luke Paireepinart" <[EMAIL PROTECTED]> wrote
> well, some experimentation leads me to believe this is the syntax
> for
> list slicing:
The referemnce link I poosted gives the exact syntax plus this
description:
--
The semantics for a simple slicing are as follows. The primar
"Dick Moores" <[EMAIL PROTECTED]> wrote
>>I could send you a link but I'd just google 'python list slicing' to
>>find it, so I'll leave that as an exercise for the reader.
>
> I don't find Google of help with this. Could someone supply a link?
Not sure why it didn't help you Dick, but it led me
52 matches
Mail list logo