"max baseman" <[EMAIL PROTECTED]> wrote
> im checking if a number is in all 5 of the other lists and when
> i use the and command it seems to just be checking if it's in a
> least
> one of the others,
> for num in l2 and l3 and l4 and l5 and l6: # here seems to be the
Try:
if num in I2 and nu
thanks much you really helped me if anyone wants here is the program:
n2=2
n3=3
n4=4
n5=5
n6=6
n7=7
l2=[]
l3=[]
l4=[]
l5=[]
l6=[]
l7=[]
while n2 < 1000:
l2.append(n2)
n2=n2+2
while n3 < 1000:
l3.append(n3)
n3=n3+3
while n4 < 1000:
l4.append(n4)
n4=n4+4
while n5 < 1000
max baseman wrote:
> thanks much you really helped me if anyone wants here is the program:
Hmmm...this is quite wordy. Some suggestions below:
>
> n2=2
> n3=3
> n4=4
> n5=5
> n6=6
> n7=7
> l2=[]
> l3=[]
> l4=[]
> l5=[]
> l6=[]
> l7=[]
> while n2 < 1000:
> l2.append(n2)
> n2=n2+2
This c
"Kent Johnson" <[EMAIL PROTECTED]> wrote
> possible = set(xrange(4, 1000, 4)).intersection(xrange(5, 1000, 5))
> \
> .intersection(xrange(6, 1000, 6))
>
Kent,
I've noticed in a few of your replie recemntly you have been using
xrange rather than range. I was under the impression that
Actually, regarding inspect.getsource() that raised IOErrors:
Running it from imported module actually works!
Thanks
Bernard
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Alan Gauld wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>
>> possible = set(xrange(4, 1000, 4)).intersection(xrange(5, 1000, 5))
>> \
>> .intersection(xrange(6, 1000, 6))
>>
>
> Kent,
>
> I've noticed in a few of your replie recemntly you have been using
> xrange rather than ra
okay here "simple" examples about why I have to define callbacks as
strings instead of code.
In XSI, one of the GUI objects that you can create is called a "custom
property". A custom property is basically a floating window in which
there are widgets. Custom properties can define a layout or not.
Bernard Lebel wrote:
> In the task I'm currently having, I have to dynamically create a
> certain number of layout elements along its logic. The number of
> elements to create changes from one execution to the next, as it is
> driven by the user input. Since properpty plugins do not support such
>
Greeting!
I'm learning Python through the book "Python Programming, Second Edition
for the absolute beginner" by Michael Dawson. In it, he has the program
"Guess my number" (code pasted below). His challenge is to modify the
code so that there are only a limited number of attempts before the
progr
Tino Dai wrote:
> Hi there,
>
> I am wondering about a short cut to doing this. Let's say that we
> have an array:
>
> dbs= ['oracle','mysql','postgres','infomix','access']
>
> and we wanted to do this:
>
> if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs:
><... do something ...>
>
On Thursday 23 August 2007, Kent Johnson wrote:
> > I would welcome some opinions on this matter.
>
> Make a file called mylibraries.pth with contents
> /path/to/mylibraries
Aha! User-defined .pth file is recognized by python
> Put the file in your site-packages folder (I don't know wherethat is
Hi there,
I am wondering about a short cut to doing this. Let's say that we have
an array:
dbs= ['oracle','mysql','postgres','infomix','access']
and we wanted to do this:
if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs:
<... do something ...>
Is there a short way or writing this? S
On Friday 24 August 2007, Tim Johnson wrote:
> On Thursday 23 August 2007, Kent Johnson wrote:
> > > I would welcome some opinions on this matter.
> >
> > Make a file called mylibraries.pth with contents
> > /path/to/mylibraries
>
> Aha! User-defined .pth file is recognized by python
>
> > Put the
Tino Dai wrote:
> I am wondering about a short cut to doing this. Let's say that we
> have an array:
>
> dbs= ['oracle','mysql','postgres','infomix','access']
>
> and we wanted to do this:
>
> if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs:
><... do something ...>
>
> Is there a
> -Original Message-
>
...
> > for num in l2:
> > if num in l3 and num in l4 and num in l5 and num in l6:
> > possible.append(num)
Yikes! Glancing at the code, I was reading l3, l4, l5, l6 as the numbers
13, 14, 15, 16..(Thirteen, Fourteen, Fifteen, Sixteen). I'd avoid us
"Paul W Peterson" <[EMAIL PROTECTED]> wrote
> "Guess my number" (code pasted below). His challenge is to modify the
> code so that there are only a limited number of attempts before the
> program exits with a chastising message.
>
> Try as I may, I cannot seem to get the syntax correct for nes
At 11:49 AM 8/23/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>>Two reasons. First, looking up a name that is local to a function
>>>is faster than looking up a global name. To find the value of
>>>'str', the interpreter has to look at the module namespace, then
>>>the built-in namespace. Thes
On Fri, Aug 24, 2007 at 09:52:16AM -0400, Kent Johnson wrote:
Kent and Alan -
Thanks for encouraging me to do a little reading and experimenting.
I thought xrange() returned an iterator. I was wrong.
Actually xrange() returns an xrange object which, according to the
docs, is "an opaque sequenc
"Chris Calloway" <[EMAIL PROTECTED]> wrote
> >>> dbs = set(['oracle','mysql','postgres','infomix','access'])
> >>> mine = set(['oracle','mysql','bdb'])
> >>> dbs & mine
> set(['oracle', 'mysql'])
> >>> dbs - mine
> set(['access', 'infomix', 'postgres'])
Interesting. I didn't know about the & an
Dick Moores wrote:
>>> This time I added "xrange(10, end, 10)" and did the timing using
>>> the template in the timeit module:
>>> template = """
>>> def inner(_it, _timer):
>>> _t0 = _timer()
>>> from itertools import chain
>>> end = 100
>>> for _i in _it:
>>> for
"Tino Dai" <[EMAIL PROTECTED]> wrote
> dbs= ['oracle','mysql','postgres','infomix','access']
>
> and we wanted to do this:
>
> if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs:
> <... do something ...>
>
> Is there a short way or writing this? Something like
>('oracle','mysql','bdb'
Dave Kuhlman wrote:
> I thought xrange() returned an iterator. I was wrong.
>
> Actually xrange() returns an xrange object which, according to the
> docs, is "an opaque sequence".
Interesting. So an xrange object is an iterable sequence, not an iterator.
Kent
___
Kent Johnson wrote:
> Dave Kuhlman wrote:
>
>> I thought xrange() returned an iterator. I was wrong.
>>
>> Actually xrange() returns an xrange object which, according to the
>> docs, is "an opaque sequence".
>>
>
> Interesting. So an xrange object is an iterable sequence, not an iterator.
Alan Gauld wrote:
> "Chris Calloway" <[EMAIL PROTECTED]> wrote
>
> dbs = set(['oracle','mysql','postgres','infomix','access'])
> mine = set(['oracle','mysql','bdb'])
> dbs & mine
>> set(['oracle', 'mysql'])
> dbs - mine
>> set(['access', 'infomix', 'postgres'])
>
> Interesting. I
Paul W Peterson wrote:
> Could you provide a way to achieve this
> using nested while statements, or suggest a better use of the ifs?
You could use one while statement.
while guess != the_number and tries < 5:
I can't think of a *good* way to use nested whiles for your problem.
> Ellicott, Col
At 10:22 AM 8/24/2007, Kent Johnson wrote:
>Dick Moores wrote:
This time I added "xrange(10, end, 10)" and did the timing using
the template in the timeit module:
template = """
def inner(_it, _timer):
_t0 = _timer()
from itertools import chain
end = 1
Dick Moores wrote:
> At 10:22 AM 8/24/2007, Kent Johnson wrote:
>> So you actually pasted that code into timeit.py?
>
> Yeah. :-( I think I learned on the Tutor list to do it that way, but I'm
> not sure. Thanks for showing me a correct way.
I hope not!
>> Using timeit more conventionally I get
At 12:12 PM 8/24/2007, Kent Johnson wrote:
Dick Moores wrote:
At 10:22 AM 8/24/2007, Kent
Johnson wrote:
So you actually pasted that code
into timeit.py?Yeah. :-( I think I learned on the Tutor list
to do it that way, but I'm not sure. Thanks for showing me a correct
way.
I hope not!
Using timei
Dick Moores wrote:
>At 10:22 AM 8/24/2007, Kent Johnson wrote:
>>So you actually pasted that code into timeit.py?
>Yeah. :-( I think I learned on the Tutor list to do it that way, but
>I'm not sure. Thanks for showing me a correct way.
I hope not!
>>Using timeit more conventionally I get unsurpr
-Original Message-
>From: Dick Moores <[EMAIL PROTECTED]>
>Sent: Aug 24, 2007 4:30 PM
>To: Python Tutor List
>Subject: Re: [Tutor] A fun puzzle
>
>Dick Moores wrote:
>>At 10:22 AM 8/24/2007, Kent Johnson wrote:
>>>So you actually pasted that code into timeit.py?
>>Yeah. :-( I think I lea
Dick Moores wrote:
>> Using your exact code, I just got
>> 0.737564690484
>> 1.17399585702
>> Which is the reverse of your result, but on a slower computer.
>
> That result was gotten using Ulipad. Thought I'd try it at my command
> line (several times, of course--I've reported what seemed to be
Hello all,
I had this question all written up, then found I had the answer:-) So I decided
to share anyway in case anyone found it useful
--
I am trying to write a script that will open terminal windows for me, based on
certain criteria. In this case, gnome-termin
"wormwood_3" <[EMAIL PROTECTED]> wrote
> want to basically spawn the process so it keeps running regardless
> of what the script does next (like running something with " &" after
> it in linux).
Umm, so just put the ampersand at the end of the command string and
call os.system()
> All I ended
Hello.
I would like to know, how can I read (or sort) a dictionary in a certain
order?
say this is my dictionary-
attrs={u'title': u'example window title', u'name': u'SELF', u'icon':
u'e.ico'}
how could I get the data so that u'name' is read first, u'title' second,
and u'icon' third?
thanks so much
Alan Gauld wrote:
> "max baseman" <[EMAIL PROTECTED]> wrote
>> im checking if a number is in all 5 of the other lists and when
>> i use the and command it seems to just be checking if it's in a
>> least
>> one of the others,
>
>
>> for num in l2 and l3 and l4 and l5 and l6: # here seems to be th
Tim Johnson wrote:
> I have a seperate library directory both on my work station on
> the the remote servers that I write applications for..
>
> I commonly use sys.path.append('/path/to/mylibraries') in my
> python code.
>
> That code has to be placed in any standalone script that I write.
> I c
Ricardo Aráoz wrote:
> Alan Gauld wrote:
>> "max baseman" <[EMAIL PROTECTED]> wrote
>>> im checking if a number is in all 5 of the other lists and when
>>> i use the and command it seems to just be checking if it's in a
>>> least
>>> one of the others,
>>
>>> for num in l2 and l3 and l4 and l5 and
"Trey Keown" <[EMAIL PROTECTED]> wrote
> I would like to know, how can I read (or sort) a dictionary in a
> certain
> order?
Dictionaries are by design unsorted and indeed may even change
their order during their lifetime.
> attrs={u'title': u'example window title', u'name': u'SELF', u'icon':
>
>>Umm, so just put the ampersand at the end of the command string and
>>call os.system()
Not sure what the point of this variation would be if os is being deprecated
along with commands...
>>However both os.system and the commands module are deprecated in
>>favour
>>of the new(ish) subprocess m
> "Trey Keown" <[EMAIL PROTECTED]> wrote
>
>> I would like to know, how can I read (or sort) a dictionary in a
>> certain
>> order?
>
> Dictionaries are by design unsorted and indeed may even change
> their order during their lifetime.
>
>> attrs={u'title': u'example window title', u'name': u'SELF'
Hello all,
I am working on trying to understand classes by creating a
character generator for a rpg. I know I am doing something silly but I
am not sure what. When I run the program I and type no when prompted I
get the following message:
Traceback (most recent call last):
File "/Users/ara/Do
Ara Kooser wrote:
> Hello all,
>
>I am working on trying to understand classes by creating a
> character generator for a rpg. I know I am doing something silly but I
> am not sure what. When I run the program I and type no when prompted I
> get the following message:
> Traceback (most recent c
42 matches
Mail list logo