Re: [Tutor] Beginner Question

2013-10-23 Thread Albert-Jan Roskam
On Wed, 10/23/13, Steven D'Aprano st...@pearwood.info wrote: Subject: Re: [Tutor] Beginner Question To: tutor@python.org Date: Wednesday, October 23, 2013, 5:27 AM On Tue, Oct 22, 2013 at 04:25:59PM +0200, Sven Hennig wrote:   Hello, I would

Re: [Tutor] Beginner Question

2013-10-23 Thread Oscar Benjamin
On 23 October 2013 08:58, Albert-Jan Roskam fo...@yahoo.com wrote: So the built-in 'len()' is *really* a function, but calls to len() implemented by __len__ are method calls *disguised* as function calls? I sometimes find it easier to write calls to special methods the normal way, e.g.

Re: [Tutor] Beginner question on classes

2013-10-23 Thread Alan Gauld
On 23/10/13 08:25, Corinne Landers wrote: Hi guys, I need a bit of help. I'm writing a class, and in the main function I'm trying to say if this method gets called, do this. What you are actually doing is if the method returns a truth-like value do this. Not quite the same thing, but much

Re: [Tutor] Beginner question on classes

2013-10-23 Thread Oscar Benjamin
On 23 October 2013 08:25, Corinne Landers corinne.land...@live.com wrote: Hi guys, Hi Corrine, I need a bit of help. I'm writing a class, and in the main function I'm trying to say if this method gets called, do this. I'm trying things like: program = AnimalClass(x,y,z) for i in

Re: [Tutor] Beginner question on classes

2013-10-23 Thread Dave Angel
On 23/10/2013 03:25, Corinne Landers wrote: --/style/head body class='hmmessage'div dir='ltr'Hi guys,nbsp;divbr/divdivI need a bit of help.nbsp;/divdivI'm writing a class, and in the main function I'm trying to say if this method gets called, do this.nbsp;/divdivI'm trying things

Re: [Tutor] Beginner Question

2013-10-22 Thread Alan Gauld
On 22/10/13 15:25, Sven Hennig wrote: Hello, I would like to learn a programming language and have decided to use Python. I have some programming experience and doing well in Python. What really causes me problems is OOP. Don't worry this is common. The problem with OOP is that it only really

Re: [Tutor] Beginner Question

2013-10-22 Thread Andy McKenzie
On Tue, Oct 22, 2013 at 10:25 AM, Sven Hennig shenni...@googlemail.comwrote: Hello, I would like to learn a programming language and have decided to use Python. I have some programming experience and doing well in Python. What really causes me problems is OOP. I'm just dont get it... I'm

Re: [Tutor] Beginner Question

2013-10-22 Thread Dave Angel
On 22/10/2013 10:25, Sven Hennig wrote: Hello, I would like to learn a programming language and have decided to use Python. I have some programming experience and doing well in Python. What really causes me problems is OOP. I'm just dont get it... I'm missing a really Practical example. In

Re: [Tutor] Beginner Question

2013-10-22 Thread Sven Hennig
Thank you! You guys helped me out alot. @Alan your website is great! Really clearly written. Especially the Things to remember part. If you have exercises for me or have a Website with exercises, bring it on. I think this is the best way to learn. 2013/10/22 Dave Angel da...@davea.name On

Re: [Tutor] Beginner Question

2013-10-22 Thread Alan Gauld
On 22/10/13 19:18, Sven Hennig wrote: Thank you! You guys helped me out alot. @Alan your website is great! Really clearly written. Especially the Things to remember part. Glad you like it. Someday (soon!) I'll get round to finishing the v3 version... So much to do, so little time! If you

Re: [Tutor] Beginner Question

2013-10-22 Thread Steven D'Aprano
On Tue, Oct 22, 2013 at 04:25:59PM +0200, Sven Hennig wrote: Hello, I would like to learn a programming language and have decided to use Python. I have some programming experience and doing well in Python. What really causes me problems is OOP. I'm just dont get it... I'm missing a really

Re: [Tutor] Beginner question

2013-08-12 Thread Ciaran Mooney
On 10 Aug 2013, at 04:30, eschneide...@comcast.net wrote: I've been learning python from the website 'inventwithpython.com', and I'm on a chapter that covers the following code: import random import time def displayIntro(): print('You are in a land full of dragons. In front of you,')

Re: [Tutor] Beginner question

2013-08-12 Thread Jim Mooney
On 12 August 2013 02:14, Karim Liateni kliat...@gmail.com wrote: 5ÿt5ÿ6hhhyyyfrrtr eschneide...@comcast.net a écrit : I've been learning python from the website 'inventwithpython.com', and I'm on a chapter that covers the following code: Just a quick note - not on the algorithm itself. If

Re: [Tutor] Beginner question

2013-08-12 Thread Krishnan Shankar
def checkCave(chosenCave): print('You approach the cave...') time.sleep(2) print('It is dark and spooky...') time.sleep(2) print('A large dragon jumps out in front of you! He opens his jaws and...') print() time.sleep(2) friendlyCave = random.randint(1, 2) if

Re: [Tutor] Beginner question

2013-08-12 Thread Krishnan Shankar
But in the code there is a flaw. input() will evaluate your user input. i.e. If you give an integer expression it will tell the answer. And when you provide a number it will take it as int type. See below. Hi, Ignore my above statements if using Python 3. Sorry my bad. Had a doubt and went to

Re: [Tutor] Beginner question

2013-08-11 Thread Alan Gauld
On 10/08/13 04:30, eschneide...@comcast.net wrote: I've been learning python from the website 'inventwithpython.com', and I'm on a chapter that covers the following code: import random import time def displayIntro(): print('You are in a land full of dragons. In front of you,') print('you

Re: [Tutor] beginner question

2011-11-01 Thread Steve Willoughby
On 01-Nov-11 08:34, Mayo Adams wrote: When writing a simple for loop like so: for x in f where f is the name of a file object, how does Python know to interpret the variable x as a line of text, rather than,say, an individual character in the file? Does it automatically treat text files

Re: [Tutor] beginner question

2011-11-01 Thread Peter Otten
Steve Willoughby wrote: On 01-Nov-11 08:34, Mayo Adams wrote: When writing a simple for loop like so: for x in f where f is the name of a file object, how does Python know to interpret the variable x as a line of text, rather than,say, an individual character in the file? Does it

Re: [Tutor] beginner question

2011-11-01 Thread Steven D'Aprano
Mayo Adams wrote: When writing a simple for loop like so: for x in f where f is the name of a file object, how does Python know to interpret the variable x as a line of text, rather than,say, an individual character in the file? Does it automatically treat text files as sequences of

Re: [Tutor] Beginner question(s)

2006-06-19 Thread David Rock
* Ismael Garrido [EMAIL PROTECTED] [2006-06-18 19:34]: Alan Gauld wrote: Also, does anyone know of a PDA that would run python? There was a project called pippy, but I haven't heard anything of it recently so I don't know if its still around or if it runs on modern PDAs - I

Re: [Tutor] Beginner question(s)

2006-06-18 Thread Alan Gauld
message = raw_input(Enter your message:) for i in range(len(message)-1,-1, -1): print i, but I just get the numeric values of the string. Can anyone help? As an alternative approach consider converting to a list and using the reverse method... Also, does anyone know of a PDA that

Re: [Tutor] Beginner question(s)

2006-06-18 Thread Ismael Garrido
Alan Gauld wrote: Also, does anyone know of a PDA that would run python? There was a project called pippy, but I haven't heard anything of it recently so I don't know if its still around or if it runs on modern PDAs - I think it was PalmOS anyhow... Pippy is quite dead. No

Re: [Tutor] Beginner Question

2006-06-18 Thread Daniel McQuay
On 6/18/06, Josh F [EMAIL PROTECTED] wrote: re. Beginner QuestionI'm still in the fairly early stages of learning Python, but I have anintermediate level of HTML, CSS, and VB6 knowledge along with thefundamentals of C and C++ and a very little bit of PERL.. But enough about me...Here's the

Re: [Tutor] Beginner question(s)

2006-06-18 Thread John Fouhy
Also, does anyone know of a PDA that would run python? Some of the new Nokias run python: http://www.forum.nokia.com/python -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Beginner question (variables, namespaces...) (fwd)

2006-04-08 Thread Kent Johnson
From: Jesse [EMAIL PROTECTED] I tried redefining the higher-order variables as functions, but it didn't quite work. Here's a simplified example: var1 = 2 def timestwo(x): return x*2 var2 = timestwo(var1) print var1, var2 var1 = 3 print var1, var2 This results in the

Re: [Tutor] Beginner question (variables, namespaces...) (fwd)

2006-04-08 Thread Danny Yoo
I tried redefining the higher-order variables as functions, but it didn't quite work. Here's a simplified example: var1 = 2 def timestwo(x): return x*2 var2 = timestwo(var1) print var1, var2 var1 = 3 print var1, var2 Try: ## print 2, timestwo(2) print 3, timestwo(3) ##

Re: [Tutor] Beginner question (variables, namespaces...) (fwd)

2006-04-08 Thread Danny Yoo
..which is not what I'm aiming for. Maybe I'll have to follow Bob's advice and just store all of the variable assignments in a function, and then call the function every time I change one of the variables (based on user input). I could still leave the higher-order variables as functions

Re: [Tutor] Beginner question (variables, namespaces...)

2006-04-07 Thread Danny Yoo
On Fri, 7 Apr 2006, Jesse wrote: Why is it that when one variable is assigned a value in terms of another variable, assigning a new value to the first doesn't change the value of the second? Hi Jesse, If you have a variable that depends on the values of other parameters, that's just

Re: [Tutor] Beginner question (variables, namespaces...)

2006-04-07 Thread Bob Gailer
Jesse wrote: Why is it that when one variable is assigned a value in terms of another variable, assigning a new value to the first doesn't change the value of the second? This is giving me a huge headache, since I have a bunch of variables defined in terms of one another, and I want to be

Re: [Tutor] Beginner question (variables, namespaces...) (fwd)

2006-04-07 Thread Danny Yoo
-- Forwarded message -- Date: Fri, 7 Apr 2006 21:05:33 -0600 From: Jesse [EMAIL PROTECTED] To: Danny Yoo [EMAIL PROTECTED] Subject: Re: [Tutor] Beginner question (variables, namespaces...) I tried redefining the higher-order variables as functions, but it didn't quite work