How come when I ask it to print i[2:4] from an inputted string it
gives me the letters between two and four
But when I ask it to print i[-1:-4] it does not print anything.
Jim
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/
> We're not going to do your homework problems; please understand that we
> actually don't care if you get your homework done. And I really hope that
> people don't just start blurting stuff at Jim for the other three homework
> problems he's dumping on us.
Hi Jim,
Ok, I screwed up big time to
def computer_move(board, computer,
human): board = board[:] BEST_MOVES
= [4,0,2,6,8,1,3,5,7] corners =
[(0,8),(2,6)] print "I shall take square
number", for move in
legal_moves(board): board[move] =
computer if winner(board) ==
computer:
print move
Thanks for everybodys input. Am learning slowly but surely.
Ben
On 4/13/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]
> wrote:Quoting Joseph Quigley <[EMAIL PROTECTED]
>:> prefixes = 'JKLMNOPQ'> suffix = 'ack'>> for letter in prefixes:> if letter == ('O') or ('Q'):> print letter + 'u' + suffix>
On Apr 12, 2005, at 23:22, Danny Yoo wrote:
There was an interesting article by Phillip Eby about what conventions
work and don't work when one makes a jump from Java to Python:
http://dirtsimple.org/2004/12/python-is-not-java.html
A very interesting read. Thanks for the link, Danny!
-- Max
Hi Tim,
Hmmm, I may have to play with _winreg, is is new with Python 2.4?
Anyway, from the _winreg docs -
EnumValue(
key, index)
Enumerates values of an open registry key, returning a tuple.
key is an already open key, or any one of the predefined
HKEY_* constants.
index is an in
Quoting Luke Jordan <[EMAIL PROTECTED]>:
> But this does not:
>
> def aFunc(configArg):
> print "aFunc with argument"
> print configArg
>
> def anotherFunc(configArg):
> print "anotherFunc with argument"
> print configArg
> return aFunc,1
^^
> def dispatch(func,configArg
Hi!
I am using a suggestion from this list to handle calling different
functions conditionallly based on user input. What I'm trying to do is
have functions that are 'configurable' in the sense that a choice from
the user affects the way it performs.
This works:
def aFunc():
print "a
> In the print word [::-1] line it gives me this message
> (sequence index must be an integer) What does that mean
As others have said, it means you're using Python 2.2 or older (so can't use
extended slicing). It seems likely that what you're after is the loop
approach that has been mentioned b
Quoting Joseph Quigley <[EMAIL PROTECTED]>:
> prefixes = 'JKLMNOPQ'
> suffix = 'ack'
>
> for letter in prefixes:
> if letter == ('O') or ('Q'):
> print letter + 'u' + suffix
> else:
> print letter + suffix
Hi Joseph,
This still won't work. The reason is that your if statement is
> An IP Camera will send images to the server via ftp to a folder.
> Each user has a folder and I want to know how I can make my app to
> check the folders ('cause there is going to be many cameras sending
> files and that means that the app will have to check every folder)
> every x seconds?
> Wi
> I have wrote 3 other programs in the class.
Hi Jim,
[cut]
Ok, that's where I have to stop you for a moment.
We're not going to do your homework problems; please understand that we
actually don't care if you get your homework done. And I really hope that
people don't just start blurting stu
[Hi Mark, I'm not the original poster of the question. I've forwarded
your reply back to tutor as well as the original poster. Thanks!]
-- Forwarded message --
Date: Wed, 13 Apr 2005 14:56:18 -0400
From: "Leeds, Mark" <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subjec
> I cannot write a program that gives me a double letter.
> I can get each letter separate or pieces or parts of the word
Hi Jim,
[Please don't reply just to me: use the Reply-to-All feature on your email
program. This allows your reply to be seen by the rest of us here. I
want to make sure yo
Have you tried to call file2.class_of_file2.funcl
Let me know how it went
Regards
Alberto
Gaucho>From: pxlpluker <[EMAIL PROTECTED]> >To: tutor@python.org >Subject: [Tutor] i need to see a var from any where in my app - im clueless >Date: Wed, 13 Apr 2005 16:19:05 -0400 > > i have read
i have read the book and searched the group too
--
im not gettin it.
i want to read a global (OPTIONS) from file1 from a class method
(func1) in file2
but i cant see the OPTION from func1
--
#file1.py
impor
am new to python and want to learn this language. I am having troubles
finding examples and tutorials for use on windows boxes. I do most of my
stuff in perl and php but want better socket support, so I am giving python
a try. I am writing a script to connect to remote registry's because of
this
Ben Vinger wrote:
It sounds like you've been using the Python
interactive prompt such as IDLE. You can type the
same Python statements you've used there into a text
editor or Python IDE and save it.
Let's say you have created a Python program/script
called hello.py in a text editor and saved it.
>Well you did come up with a way that would work sort of and you seem to be
>ont eh right track. I would make 1 small change if using your approach.
>
>prefixes = 'JKLMNOPQ'
>suffix = 'ack'
>
>for letter in prefixes:
> if letter == 'O' or letter == 'Q': print letter + 'u' + suffix
> else: print l
It sounds like you've been using the Python
interactive prompt such as IDLE. You can type the
same Python statements you've used there into a text
editor or Python IDE and save it.
Let's say you have created a Python program/script
called hello.py in a text editor and saved it. You can
now open a
Marcus Goldfish gmail.com> writes:
> This raised another design issue for me, tho', regarding property
> validation. In C#/Java, I would typically do validation in all of my
> setter methods, but is this really pythonic? It seems OO--
> encapsulation-- but also seems to be one of the biggest wa
Joseph Quigley said unto the world upon 2005-04-13 13:05:
def silly(this_is_serious):
print 'this is serious"
But I get an error!
Traceback (most recent call last):
File "C:\Python24\saved\tmp1.py", line 7, in -toplevel-
silly(this_is_serious)
NameError: name 'this_is_serious' is not
> From: Feziwe Mpondo sanbi.ac.za>
>
> how to run a programm after you have typed in the commands
Depends on where you type those commands.
If you type them in the interactive interpreter, they are executed whenever you
press Enter. However, this method does not allow you to run the same progr
At 02:02 PM 4/11/2005, you wrote:
Send Tutor mailing list submissions to
tutor@python.org
Hey all,
Sorry for the bother, thanks for the help
#first of all, why does this have to be here?
password="foobar"
count=3
current_count=0
while password !="unicorn":
if current_count
print "
Oh, now I understand
def silly(a_name_I_picked_at_random): # well, not
quite
... print
a_name_I_picked_at_random # at random ;-)
...
silly(42)
42
The name a_name_I_picked_at_random is like a "placeholder"
inside the
function for whatever input we gave to the function. And *th
It works if you run from the command line instead of inside IDLE. I
thought IDLE was supposed to be
able to run Tkinter programs since Python 2.3 but it doesn't seem to work?
AFAIK IDLE runs on Linux. There are many other possibilities listed here:
http://www.python.org/moin/IntegratedDeve
-- Forwarded message --
Date: Wed, 13 Apr 2005 09:01:16 -0500
From: Jim and Laura Ahl <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Python backwards program (fwd)
Danny
I cannot write a program that gives me a double letter.
I can get each letter se
-- Forwarded message --
Date: Wed, 13 Apr 2005 17:12:55 +0200
From: Feziwe Mpondo <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: help
how to run a programm after you have typed in the commands
___
Tutor maillist - Tutor@python.or
Thanks for all of the comments! The general theme of "don't use a
property unless you need to" is intuitive, and is what I was hoping
the consensus would be.
This raised another design issue for me, tho', regarding property
validation. In C#/Java, I would typically do validation in all of my
set
Robert, Andrew wrote:
Hi Everyone,
I am trying to do an MQ inquiry but I am having mixed results.
If I do the command direct via a print statement like the one below, it
works,
print 'Queue Description:\t' , q.inquire(CMQC.MQCA_Q_DESC)
When I try to cycle through an array of command line supplied k
Thank you, Liam and Steve, for the informative feedback.
Lee C
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
So there is no misunderstanding, the trial positioning would be
applicable to all levels, not just the first. In other words, solving
for each of the remaining Queens in turn is the same as for the first
Queen, except for the eighth Queen where no lower level positioning
need be considered,
On
If you go here http://en.wikipedia.org/wiki/Eight_queens_puzzle Down at
the bottom page is a very short python program that gives the solutions
to the eight queens problem in a very neat manner.
Ara
"There is something to be learned from a rainstorm. When meeting with a
sudden shower, you try
John
The type of problem you mention and the extent of positioning you go to
could result in an incomplete solution. In very general terms one
would need to place the first Queen then find an appropriate position
for the second, and each of the remaining Queens in turn until either
there are n
I read through Magnus Hetland's book and noticed the Eight Queens problem, which I had solved some time ago using Visual Basic.This time, I wanted to use a non-recursive solution. I randomly place each queen on board coordinates running from 0,0(top left hand corner of board) to 7,7(lower right han
OK. Mercy Pierre for the reply(It's my french correct :)
The OS will be Linux AS 3.0 and it will be good to know for Windows 2000 and newer also
I don't understand about the processes (I mean I do but I don't know how to code it)
This is the application:
An IP Camera will send images to the ser
Hi Everyone,
I am trying to do an MQ inquiry but I am having mixed results.
If I do the command direct via a print statement like the one below, it
works,
print 'Queue Description:\t' , q.inquire(CMQC.MQCA_Q_DESC)
When I try to cycle through an array of command line supplied keys, it
fails.
Jim and Laura Ahl wrote:
Thanks for the encouragement, here is what I have so far.
word=raw_input("Enter a Word or string:")
print word
print word[::-1]
raw_input("\n\nPress the enter key to exit.")
In the print word [::-1] line it gives me this message (sequence index
must be an integer) Wha
Thanks for the encouragement, here is what I have so far.
word=raw_input("Enter a Word or string:")
print word
print word[::-1]
raw_input("\n\nPress the enter key to exit.")
In the print word [::-1] line it gives me this message (sequence index must
be an integer) What does that mean
I h
I agree with Andrei:
Use an instance variable until you need it to do something special, and then
convert it to a property.
Thanks,
Ryan
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrei
Sent: Wednesday, April 13, 2005 2:41 AM
To: tutor@python.org
Ok, the first question is an OS related question. What OS do you use ?
For the second, this kind of deamon are usually done using processes
rather than threads. This is a lot safer and easier to achieve. I
suppose you know how to start a new process. On UNIX, the simplest way
to achieve what you
Hey
Back again I'm need to make a daemon application and to manage multithreading
The program has to check every 3 seconds if is there images inside one folder
(That's only for you to know what I'm doing in case you needed)
My first problem is that I can imagine a way to do a daemon.How can I make
OK.
I'm assuming that you're writing a .py document and you want it to run by double-clicking it in the shell, right??? And you can't see the output of your prog(that's my problem to understand English, sorry :/)
If this is your problem then add at the very bottom of your file this sentence:
ra
Alberto Troiano wrote:
You can do this:
>>> word=raw_input("Type the word: ")
Type the word: Kokiri Forest
>>> print word
Kokiri Forest
>>> print word[::-1]
tseroF irikoK
But I saw that this gave you a hard time so this is an alternate
longer way:
>>> backword=""
>>> counter=len(word)
>>> while c
Hi Lee,
You can currently use Pygtk on OSX as long as you use the Apple X
server. The easiest way is through fink which has 2.4:
http://fink.sourceforge.net/pdb/search.php?summary=pygtk
There are efforts underway to port GTK+ to OSX natively by Hubert
Figuière, but he's only just started:
http
You can do this:
>>> word=raw_input("Type the word: ")Type the word: Kokiri Forest>>> print wordKokiri Forest>>> print word[::-1]tseroF irikoKBut I saw that this gave you a hard time so this is an alternate longer way:
>>> backword="">>> counter=len(word)
>>> while counter!=0: backword+
The second option will do the trick. I use Pmw.Combobox but I didn't know there was a ScrolledFrame
Thanks a lot
Regards
Alberto
Gaucho>From: [EMAIL PROTECTED] >To: "tutor@python.org" >Subject: Re: [Tutor] Question about Frames and Scrollbars >Date: Wed, 13 Apr 2005 10:10:34 +1200 (NZST) > >A cou
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 09, 2004 12:19 PM
To: tutor@python.org
Subject: Re: [Tutor] sorting a list of dictionaries
On 9 Dez 2004, [EMAIL PROTECTED] wrote:
I have a list of dictionaries, each representing info about a
Hi Lee,
I work with wxPython and some assorted wrappers.
Personally, I always found Tkinter a little... unsatisfying. You can do
perfectly good GUIs in it, as long as they don't get too complex, but
yeah, never appealed to me.
wxPython is a lot more powerful than Tkinter, but with power comes c
Ben Markwell gmail.com> writes:
> if prefixes[n] == 'O' or 'Q':
A tip: when working with several boolean (and/or/not) conditions in one test,
it's helpful to use parentheses in order to make sure you get what you expect.
Let me demonstrate.
The example above is equivalent to:
if (prefixes[n
> > Hi people thanks to all of you for the suggestions, I am currently
> > reading some programming books but it seems as if i can't findn a
> > suitable one to get me started the way i want, i mean not only
> > learning the basics but getting prepared for more complex programming,
>
> I would say
51 matches
Mail list logo