On 31/10/11 04:40, cyclicf...@yahoo.com wrote:
With reference to a beginning editor,
I agree with most of this but...
... scripting in vim has many similarities to various types
> in python. The python forloop is definitely very similar
Thats probably because you have a vim that has been co
neubyr wrote:
Is it possible to tell whether import statement is importing a module
or package? I am going through some example code with some import
statements - like 'import os, sys, time', 'import packed'. I know os,
sys and time are (built-in) modules and 'packed' is a package here .
But can
I Use Windows.I Already Know C/C++ which makes python syntax seem very easy.
Maybe Setting Up Emacs With Python Will Make Me Productive.
I Have Eclipse With PyDev.
Why Is There Not A Pythonic Emacs?
On Mon, Oct 31, 2011 at 8:23 AM, wrote:
> Send Tutor mailing list submissions to
>tutor@p
Hello everyone,
I am having a little trouble with a block of code that isn't behaving
the way I would expect. Maybe you can give me a hand and point where it
is going wrong.
The function that is not working correctly belongs to a Paper Rock
Scissor game I am making.
This particular functio
> From: Joel Montes de Oca
> To: Tutor Python
> Subject: [Tutor] Paper Rock Scissors game - User's choice not returned
>properly
> Message-ID: <4eaec191.3060...@gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hello everyone,
>
>
> The function: ( http://dp
On Mon 31 Oct 2011 11:59:47 AM EDT, Asokan Pichai wrote:
From: Joel Montes de Oca mailto:joelmonte...@gmail.com>>
To: Tutor Python mailto:tutor@python.org>>
Subject: [Tutor] Paper Rock Scissors game - User's choice not returned
properly
Message-ID: <4eaec191.3060...@gm
On Mon, Oct 31, 2011 at 4:41 PM, Joel Montes de Oca
wrote:
> Hello everyone,
>
> I am having a little trouble with a block of code that isn't behaving the
> way I would expect. Maybe you can give me a hand and point where it is going
> wrong.
>
> The function that is not working correctly belongs
On Mon, Oct 31, 2011 at 4:38 AM, Steven D'Aprano wrote:
> neubyr wrote:
>>
>> Is it possible to tell whether import statement is importing a module
>> or package? I am going through some example code with some import
>> statements - like 'import os, sys, time', 'import packed'. I know os,
>> sys
On Mon 31 Oct 2011 12:14:40 PM EDT, Hugo Arts wrote:
On Mon, Oct 31, 2011 at 4:41 PM, Joel Montes de Oca
wrote:
Hello everyone,
I am having a little trouble with a block of code that isn't behaving the
way I would expect. Maybe you can give me a hand and point where it
is going
wrong.
The
Hugo's explanation is nice and clear.
You may also want to look at this way
Consider the most simplified form of the issue
def alpha():
if X:
beta()
else:
return q
Here in the* if branch* nothing is returned
while in the *else branch *something is being returne
On Mon, Oct 31, 2011 at 1:09 PM, Joel Montes de Oca
wrote:
> On Mon 31 Oct 2011 12:14:40 PM EDT, Hugo Arts wrote:
>
>
> On Mon, Oct 31, 2011 at 4:41 PM, Joel Montes de Oca
> wrote:
>
>
> Hello everyone,
>
> I am having a little trouble with a block of code that isn't behaving the
> way I would
On 10/31/2011 11:41 AM, Joel Montes de Oca wrote:
Hello everyone,
I am having a little trouble with a block of code that isn't behaving
the way I would expect. Maybe you can give me a hand and point where
it is going wrong.
The function that is not working correctly belongs to a Paper Rock
On Mon, Oct 31, 2011 at 10:57 AM, Joel Montes de Oca
wrote:
>
> I came up with this to solve the problem.
>
> def UserChoice (): # The function that returns the choice from the user
> while 1:
>
> print 'Please select (P) for paper, (R) for Rock, or (S) for
> Scissors.'
>
Just a minor note, this break is redundant. Breaks are used to exit (for/while)
loops but keep control in the function. A return exits the function
immediately.
if choice.lower() in ('p', 'r','s'):# Converts the user's choice to
lowercase and confirms the choice is valid
On 31/10/11 12:56, Rinu Boney wrote:
I Use Windows.I Already Know C/C++ which makes python syntax seem very easy.
Maybe Setting Up Emacs With Python Will Make Me Productive.
If you learn emacs then it will.
But learning emacs is almost as big a task as learning Python, it is a
complete user en
On 10/31/2011 02:13 PM, Prasad, Ramit wrote:
Just a minor note, this break is redundant. Breaks are used to exit (for/while)
loops but keep control in the function. A return exits the function immediately.
if choice.lower() in ('p', 'r','s'):# Converts the user's choice
to lowerca
On 31/10/11 17:09, Joel Montes de Oca wrote:
FUN MAIN
|
|
|__ FUN A
|
|
|_ FUN B
This is how I understand it. So if I want this to work, I need FUN B to
give something back to FUN A so that FUN A will have something to give
back to FUN MAIN but that doe
On 10/31/2011 02:14 PM, Marc Tompkins wrote:
On Mon, Oct 31, 2011 at 10:57 AM, Joel Montes de Oca
wrote:
I came up with this to solve the problem.
def UserChoice ():# The function that returns the choice from the user
while 1:
print 'Please select (P) for paper, (R) for R
On 31/10/11 15:59, Asokan Pichai wrote:
From: Joel Montes de Oca mailto:joelmonte...@gmail.com>>
To: Tutor Python mailto:tutor@python.org>>
Subject: [Tutor] Paper Rock Scissors game - User's choice not returned
properly
If replying via the digest please change the subje
On Mon, Oct 31, 2011 at 1:14 PM, Marc Tompkins wrote:
>
> You could simplify it even further by actually using the "while":
>
> > def UserChoice ():# The function that returns the choice from the
> user
> >choice = ''
> >attempt = 0
> >while choice.lower() not in ('p', 'r','s'):
>
* Rinu Boney [111031 07:03]:
> I Use Windows.I Already Know C/C++ which makes python syntax seem very easy.
> Maybe Setting Up Emacs With Python Will Make Me Productive.
> I Have Eclipse With PyDev.
> Why Is There Not A Pythonic Emacs?
Rinu, by this time I believe that Alan has addressed your qu
Alan Gauld wrote:
> if choice.lower() not in ('prs'): # NB use a single string
That's not a good idea. If a user accidentally enters PR (for example) your
version will mistake that for a valid choice.
___
Tutor maillist - Tutor@python.org
To unsub
Joel Montes de Oca wrote:
> def UserChoice (): # The function that returns the choice from the
> user
> while 1:
>
> print 'Please select (P) for paper, (R) for Rock, or (S) for
> Scissors.'
> choice = raw_input('What is your selection?:')
> if
Asokan Pichai wrote:
Hugo's explanation is nice and clear.
[...]
Who are you replying to, and what was the question?
Thank you for NOT quoting the entire digest, hundreds and hundreds of
lines! You would be amazed at how many people do that. But in future,
could you please quote *just enough
On 31/10/11 20:22, Peter Otten wrote:
Alan Gauld wrote:
if choice.lower() not in ('prs'): # NB use a single string
That's not a good idea. If a user accidentally enters PR (for example) your
version will mistake that for a valid choice.
Good point, although you could test the first charact
On 31/10/11 20:55, Steven D'Aprano wrote:
You may prefer to change to individual emails instead of digest mode. In
my opinion, digest mode is only useful when you want to read other
people's comments without commenting yourself.
It depends, I've used digests from other lists that delivered
the
On 10/31/2011 06:09 PM, Alan Gauld wrote:
On 31/10/11 20:55, Steven D'Aprano wrote:
You may prefer to change to individual emails instead of digest mode. In
my opinion, digest mode is only useful when you want to read other
people's comments without commenting yourself.
It depends, I've used
On 10/31/2011 1:26 PM, Asokan Pichai wrote:
Hugo's explanation is nice and clear.
You may also want to look at this way
Consider the most simplified form of the issue
def alpha():
if X:
beta()
else:
return q
Here in the*if branch* nothing is returned
None i
Alan Gauld wrote:
On 31/10/11 20:22, Peter Otten wrote:
Alan Gauld wrote:
if choice.lower() not in ('prs'): # NB use a single string
That's not a good idea. If a user accidentally enters PR (for example)
your
version will mistake that for a valid choice.
Good point, although you could t
Joel Montes de Oca wrote:
When the user enters an invalid letter, FUNCTION B calls FUNCTION A.
FUNCTION A returns choice to FUNCTION B. FUNCTION B does nothing with
the return, FUNCTION MAIN gets nothing to returned to it, thus choice is
NONE.
FUN MAIN
|
|
|__ FUN A
|
This code is from the book 'Invent your own computer games with Python'
2nd edition. Great book so far. . .
My question comes on the 2nd game (dragon game). Just a simple little
program that lets you choose to enter 'cave one' or 'cave two' by using
the random module, radnom.randint. If you ch
Marc Tompkins wrote:
It can be a little hard to wrap your head around how Python handles
variables/objects; in other languages you create a variable and assign a
value to it, while in Python you create an object and assign a name to it -
the name can change while the object remains unchanged. He
Chris Kavanagh wrote:
However, I'm confused on Line 30 {if chosenCave== str(friendlyCave)}.
Here's the description of this line the author gives:
"Here we check if the integer of the cave we chose ('1' or '2') is equal
to the cave
randomly selected to have the friendly dragon"
My question i
On 10/31/2011 07:10 PM, Steven D'Aprano wrote:
Alan Gauld wrote:
On 31/10/11 20:22, Peter Otten wrote:
Alan Gauld wrote:
if choice.lower() not in ('prs'): # NB use a single string
That's not a good idea. If a user accidentally enters PR (for
example) your
version will mistake that for a v
Yes Steven, that solved my question(s). It also cleared up what was to
be my next question! Thanks so much. You might not realize how grateful
I am to be able to have you & others on the list answer my questions.
Just trust me when I say, I am grateful. And I apologize for the code
being mangle
I'm going to thank Steven once again, and answer my own question in the
2nd paragraph directly below (Steven hasn't had a chance to respond yet).
I just learned that the Function definitions are not read by the
interpreter UNTIL they are called. I was reading them and assuming they
were execut
This Is My Program :
class book:
def __init__(self,bno=100,bname='Book'):
self.book_number=bno
self.book_name=bname
def enter_book(self):
self.book_number=input("Enter Book No : ")
self.book_name=input("Enter Book Name : ")
def display_book(self):
I have a class 'book' and function for input and display of the class
members
then there are 2 functions for pickling and unpickling class instances from
and to a file.
after unpickling , then displaying it shows only the last class instance
stored in the file!
what can be the possible problems?
__
On 2011-11-01 06:31, Rinu Boney wrote:
def add_book(b):
fo=open('books.dat','wb')
pickle.dump(b,fo)
fo.close()
The Display After Unpickling Shows only the last Class Instance.
How To Display All The Data In The File ?
You haven't shown us the complete program (how to you call "a
39 matches
Mail list logo