Re: [Tutor] Beginner Level Projects

2018-04-19 Thread David Rock
> On Apr 18, 2018, at 20:34, Joshua Nghe wrote: > > Hi, > > This is Joshua N from Campus Middle School in CO. Our science class is > collectively participating in a project that consumes 20% of our classtime > every week. For my project, I chose to learn Python, and create something > from w

Re: [Tutor] Beginner Level Projects

2018-04-19 Thread William Ray Wing
> On Apr 18, 2018, at 9:34 PM, Joshua Nghe wrote: > > Hi, > > This is Joshua N from Campus Middle School in CO. Our science class is > collectively participating in a project that consumes 20% of our classtime > every week. For my project, I chose to learn Python, and create something > from

Re: [Tutor] Beginner: Socket object and packets

2015-12-05 Thread Cameron Simpson
On 05Dec2015 13:21, Marc Eymard wrote: Hi tutor, I am trying to locate the first blank line in the first received packet when pinging an internet server using a socket object. First up: everything ALan already said. Next: Note that the HTTP response need not all be in a single packet, thoug

Re: [Tutor] Beginner: Socket object and packets

2015-12-05 Thread Alan Gauld
On 05/12/15 13:21, Marc Eymard wrote: > Hi tutor, > > I am trying to locate the first blank line in the first received packet > when pinging an internet server using a socket object. You need to be careful with your descriptions. ping is a very specific message and uses ICMP echo rather than TCP

Re: [Tutor] Beginner - list not returning correct variable value

2014-03-13 Thread Alan Gauld
On 13/03/14 16:12, Marc Eymard wrote: In attached script, can somebody tell me why the values of the variables strenght_points, health_points, wisdom_points and dexterity_points stay at 0 value when 'printing' their value from the list attributes[] Because when you create the list you use the

Re: [Tutor] Beginner - Clarifying 'understanding randint arguments'

2014-02-17 Thread Alan Gauld
On 17/02/14 11:39, Marc Eymard wrote: Hi Tutor, The previous elements I sent to the mailing list were incomplete and needs no answer from Tutor. But you got several nonetheless. Did you read them? If so you will know that calling randint() does not change the two xxx_range variables. It simp

Re: [Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Steven D'Aprano
On Sat, Feb 15, 2014 at 04:25:34PM +, Marc Eymard wrote: > Can somebody explain why both low_range and high_range are still > returning their initial values ? Because you haven't changed either of them. Imagine the chaos if every time you did arithmetic on a variable, Python changed the var

Re: [Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Alan Gauld
On 15/02/14 16:25, Marc Eymard wrote: Here is what happens in my script: >>> import random >>> low_range = -1 >>> high_range = 101 >>> random.randint(low_range + 1, high_range - 1) 56 >>> low_range -1 >>> high_range 101* I was rather expecting:

Re: [Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Jay Lozier
On 02/15/2014 11:25 AM, Marc Eymard wrote: Hello Tutor, I need to generate a random integer between 0 and 100. The range is supposed to be adjusted by my two variables: low_range and high_range. The logic of using the variables as part of the function arguments is to manage to get a smaller

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-14 Thread David Hutto
Just to add a footnote to the above remember: http://en.wikipedia.org/wiki/Random_seed unless setting your own random seed algorithm is applied. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.o

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-14 Thread David Hutto
On Fri, Feb 14, 2014 at 10:49 PM, David Hutto wrote: > Here is a problem I've come across, from empirical evidence, that also > relates to your equation. We always assume > that their are always two probabilities, that a coin can be either head > or tails. > > However, there are dynamics within a

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-14 Thread David Hutto
Here is a problem I've come across, from empirical evidence, that also relates to your equation. We always assume that their are always two probabilities, that a coin can be either head or tails. However, there are dynamics within a third realm of the dimensionality of the coin...it's not a two d

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-13 Thread Neil Cerutti
On 2014-02-12, Steven D'Aprano wrote: > Of course attachments are "a thing" in Usenet. One of the > reasons so few ISPs offer News services these days is because > of the *huge* volume of attachments on binary news groups. Any > news client that can't at least *receive* attachments is a > major fa

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Thu, Feb 13, 2014 at 10:25:04AM +1100, Steven D'Aprano wrote: > On Wed, Feb 12, 2014 at 05:26:26PM -0500, Dave Angel wrote: > > The nntp news system tossed the attachments, I believe. > > If you check out the gmane.comp.python.tutor mirror, you will see the > attachments. Er, that is to say

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 05:26:26PM -0500, Dave Angel wrote: > He posted in html and included two attachments. His email program > added added a text version, which we know is frequently bogus. "Frequently?" I don't think so. I hardly ever see text parts which don't say the same thing as the ht

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 10:31:51PM +0100, spir wrote: > On 02/12/2014 10:14 PM, Steven D'Aprano wrote: > >The first thing to notice is that by the logic of the task, each flip > >must be either a Head or a Tail, so the number of Heads and the number > >of Tails should always add up to the number o

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 09:30:22PM +, Neil Cerutti wrote: > > Perhaps it is time for you to give up on whatever tool you are > > using to read this mailing list, or at least to change your > > assumption when you see a contentless message from "Original > > poster didn't send email" to "I can'

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Dave Angel
Steven D'Aprano Wrote in message: > On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: >> Marc Eymard Wrote in message: >> > ___ >> > Tutor maillist - Tutor@python.org >> > To unsubscribe or change subscription options: >> > https://mail.py

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread spir
On 02/12/2014 10:14 PM, Steven D'Aprano wrote: On Wed, Feb 12, 2014 at 03:25:22PM +, Marc Eymard wrote: I want to emulate a coin flip and count how many heads and tails when flipping it a hundred times. In my last reply, I said I'd next give you some pointers to improve the code. If you'

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Neil Cerutti
On 2014-02-12, Steven D'Aprano wrote: > On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: >> Next time please post in text form rather than html, and >> actually include the code you're asking us to comment on. > > Dave, your tools are letting you down. Marc did post in text, and did >

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 03:25:22PM +, Marc Eymard wrote: > I want to emulate a coin flip and count how many heads and tails when > flipping it a hundred times. In my last reply, I said I'd next give you some pointers to improve the code. If you'd rather work on it yourself first, stop rea

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 03:25:22PM +, Marc Eymard wrote: > However, I still don't understand the bug since, in my understanding, > both files are incrementing variable count_flips each time until the > loop becomes false. The problem with the "wrong" file is that it increments the count_fla

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread R. Alan Monroe
> When running it, either returned values are wrong or the script > seems to enter in an infinite loop showing no return values at all. One other tip: "for" loops are usually more practical when you know exactly how many times you want to loop (100 coin flips). "while" loops are usually more prac

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Steven D'Aprano
On Wed, Feb 12, 2014 at 02:08:17PM -0500, Dave Angel wrote: > Marc Eymard Wrote in message: > > ___ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > https://mail.python.org/mailman/listinfo/tutor > > > Next

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Zachary Ware
Hi Marc, On Wed, Feb 12, 2014 at 9:25 AM, Marc Eymard wrote: > Hello there, > > I want to emulate a coin flip and count how many heads and tails when > flipping it a hundred times. > > I first coded coinflip_WRONG.py with "count_flips += 1" statement within the > if/else block. > When running it,

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Alan Gauld
On 12/02/14 15:25, Marc Eymard wrote: However, I still don't understand the bug since, in my understanding, both files are incrementing variable *count_flips* each time until the loop becomes false. > count_heads = 0 > count_tails = 0 > count_flips = 0 > > while count_flips != 100: This is usu

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread Dave Angel
Marc Eymard Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > Next time please post in text form rather than html, and actually include the

Re: [Tutor] Beginner - explaining 'Flip a coin' bug

2014-02-12 Thread R. Alan Monroe
> Can somebody explain the reason of the bug. I think you have an indentation goof on line 24 in the "wrong" version (the else clause). Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org

Re: [Tutor] Beginner question on classes

2013-10-23 Thread Dave Angel
On 23/10/2013 03: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. I'm trying things > like:program = AnimalClass(x,y,z)for i > in range(x):   for j in range(y):  >    

Re: [Tutor] Beginner question on classes

2013-10-23 Thread Oscar Benjamin
On 23 October 2013 08:25, Corinne Landers 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 range(x): >for j in r

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 ea

Re: [Tutor] Beginner Question

2013-10-23 Thread Oscar Benjamin
On 23 October 2013 08:58, Albert-Jan Roskam 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. instead of "

Re: [Tutor] Beginner Question

2013-10-23 Thread Albert-Jan Roskam
On Wed, 10/23/13, Steven D'Aprano 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 like to

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-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 h

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 > On 22/10/2013 10:2

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. I

Re: [Tutor] Beginner Question

2013-10-22 Thread Andy McKenzie
On Tue, Oct 22, 2013 at 10:25 AM, 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 Practica

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 b

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-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) >

Re: [Tutor] Beginner question

2013-08-12 Thread Jim Mooney
On 12 August 2013 02:14, Karim Liateni 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 you run th

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 yo

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 level: Why doesn't my code work?

2013-05-20 Thread Rafael Knuth
But this is all a distraction -- how exactly are you invoking what you think is Python 3.3.0? What is your operating system? My mistake, I am using two laptops with different operating systems (Windows 7 & SUSE 12.3). I am using Python 3.3.0 on the Windows laptop and I was wrongly assuming that I

Re: [Tutor] Beginner level: Why doesn't my code work?

2013-05-19 Thread Peter Otten
Rafael Knuth wrote: > Thank you, I am using Python 3.3.0 [Oscar] > In Python 3 you should use input(). In Python 2 you should use > raw_input(). I'm guessing that you're using Python 2. In Python 2 the > input() function tries to evaluate whatever the user types in as if it > was Python code. Sin

Re: [Tutor] Beginner level: Why doesn't my code work?

2013-05-19 Thread Steven D'Aprano
On 19/05/13 23:38, Rafael Knuth wrote: Thank you, I am using Python 3.3.0 Based on the error you show, I doubt that very much. As for the HTML ... I copied the code from the Python Shell - should I post code as a screenshot? Would that resolve that issue you mentioned? No. It has nothing t

Re: [Tutor] Beginner level: Why doesn't my code work?

2013-05-19 Thread Rafael Knuth
Hello, please post in plain text (not html) in future. Also you should mention what version of Python you're using as it makes a dfference in this case. Thank you, I am using Python 3.3.0 As for the HTML ... I copied the code from the Python Shell - should I post code as a screenshot? Would that r

Re: [Tutor] Beginner level: Why doesn't my code work?

2013-05-19 Thread Oscar Benjamin
On 19 May 2013 14:04, Rafael Knuth wrote: > Hello, Hello, please post in plain text (not html) in future. Also you should mention what version of Python you're using as it makes a dfference in this case. > > here's a tiny little program I wrote: > > import random > > print(""" > > This is a magi

Re: [Tutor] Beginner Q: What does the double underscore mean __ ?

2012-09-09 Thread Dave Angel
On 09/09/2012 08:16 AM, Aaron Pilgrim wrote: > Thank you for the response! > You're welcome. A couple points of order: please don't top-post. There is a standard here, which makes much more sense than the Microsoft-imposed "put everything backwards" approach. Put your new text AFTER whatever

Re: [Tutor] Beginner Q: What does the double underscore mean __ ?

2012-09-09 Thread Mark Lawrence
On 09/09/2012 12:27, Aaron Pilgrim wrote: Hi, I was trying to teach myself some python from a book and I have seen double underscores used. What does the __ mean and how do I know when to use it? for example: __name__==’__main__’ (source) Pilgrim, Mark (2009-10-23). Dive Into Python 3 (Books f

Re: [Tutor] Beginner Q: What does the double underscore mean __ ?

2012-09-09 Thread Dave Angel
On 09/09/2012 07:27 AM, Aaron Pilgrim wrote: > Hi, > I was trying to teach myself some python from a book and I have seen > double underscores used. > What does the __ mean and how do I know when to use it? > > for example: > > __name__==’__main__’ > > (source) > Pilgrim, Mark (2009-10-23). Dive In

Re: [Tutor] Beginner

2012-06-04 Thread Alan Gauld
On 04/06/12 19:50, dispatc...@live.com wrote: The tutorial I am using says not to write GUI in the idle section I suspect it only says not to *run* it in IDLE. Writing it in IDLE is fine. But sometimes running Tkinter apps in Idle causes strange behaviour. So save the file then run it from

Re: [Tutor] Beginner

2012-06-04 Thread Walter Prins
Hello, On 4 June 2012 19:50, dispatc...@live.com wrote: > I am new to the python idle. I am a little confused on the GUI section on > where to write it. I think that's perhaps an understatement. >> The tutorial I am using says not to write GUI in the idle section so I have > been using the pyt

Re: [Tutor] Beginner Exercise: Why Didn't I Break It?

2011-12-20 Thread Alan Gauld
On 20/12/11 18:10, Homme, James wrote: Hi Jerry, Thank you. This reminds me of single dimension arrays in VBScript. You are absolutely right, tuples are like read-only arrays in VB. We have writeable arrays in python too but we call them something else :-) BTW The list prefers bottom posting t

Re: [Tutor] Beginner Exercise: Why Didn't I Break It?

2011-12-20 Thread Homme, James
e=highmark@python.org [mailto:tutor-bounces+james.homme=highmark@python.org] On Behalf Of Jerry Hill Sent: Tuesday, December 20, 2011 1:00 PM To: tutor@python.org Subject: Re: [Tutor] Beginner Exercise: Why Didn't I Break It? On Tue, Dec 20, 2011 at 12:31 PM, Homme, James wrote: > So f

Re: [Tutor] Beginner Exercise: Why Didn't I Break It?

2011-12-20 Thread Jerry Hill
On Tue, Dec 20, 2011 at 12:31 PM, Homme, James wrote: > So far, the data types this little book has talked about are strings and > numbers. ... > return jelly_beans, jars, crates ... > # It returns three things in parentheses, which, I guess is one group of > things. I thought it would complain.

Re: [Tutor] beginner here

2011-12-07 Thread शंतनू
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08-Dec-2011, at 6:47 AM, Do youknow who wrote: > Im trying to write this program where i make it flip a coin 100 times then > tells me the number of heads and tails it came up with. > > this is what I got but it does not run > > # Coin Flip >

Re: [Tutor] beginner here

2011-12-07 Thread Dave Angel
On 12/07/2011 08:39 PM, Max S. wrote: You are using an 'elif' for your 'coin_rolls == 1:'. The 'elif' keyword means that if the last 'if' statement (and any 'elif's behind it) was *not* true, only then will it be executed. Your code could be written as 'if rolls is NOT less than or equal to 100

Re: [Tutor] beginner here

2011-12-07 Thread Max S.
You are using an 'elif' for your 'coin_rolls == 1:'. The 'elif' keyword means that if the last 'if' statement (and any 'elif's behind it) was *not* true, only then will it be executed. Your code could be written as 'if rolls is NOT less than or equal to 100, only then check to see if it is 1 or 2

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 line

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

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 troubleshooting py2exe

2011-06-27 Thread delegbede
Just curious. Going by the last line of the error generated, it says something you tried to import is not a valid windows application. Can you confirm you installed the right py2exe for python 2.7 on Win32? You may want to check that to be sure. The last line of your error stack should point

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Lisi
On Thursday 16 June 2011 19:03:27 Joel Goldstick wrote: > On Thu, Jun 16, 2011 at 1:10 PM, Lisi wrote: > > Copied and pasted: > > >From text of Learn Python the Hard Way > > > > 1 from sys import argv > > 2 > > 3 script, user_name = argv > > > > >From my script (typed, not copied and pasted, but c

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Peter Lavelle
If you need to process command line arguments then the argparse module may also be useful to you. More info can be found here: http://docs.python.org/library/argparse.html Regards Peter Lavelle On 16/06/11 19:03, Steve Willoughby wrote: On 16-Jun-11 10:10, Lisi wrote: 1 from sys import arg

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Joel Goldstick
On Thu, Jun 16, 2011 at 1:10 PM, Lisi wrote: > Copied and pasted: > >From text of Learn Python the Hard Way > > 1 from sys import argv > 2 > 3 script, user_name = argv > > >From my script (typed, not copied and pasted, but copied and pasted from > my > script to here): > > 1 from sys import argv

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Steve Willoughby
On 16-Jun-11 10:10, Lisi wrote: 1 from sys import argv 2 3 script, user_name = argv I have tried every permutation of white space I could think of that might have looked like the original, but I always get the same error: That will work ONLY if argv has at least 2 values in it. Your source

Re: [Tutor] Beginner needs help with tkinter and images

2011-05-18 Thread Alan Gauld
"Adam Westrum" wrote I've got a basic program going right now, with 4 buttons. Forward backward right and left. Each button goes to an image of a colored circle. Problem i'm having is that when you click a button, the picture appears. When you click another button, a different picture appear

Re: [Tutor] Beginner issue with Tkinter Listbox

2008-09-04 Thread Alan Gauld
"David Johnson" <[EMAIL PROTECTED]> wrote However, as soon as call the method: ListboxName.selection_set(0), the lower frame (containing the Listbox), ends up on the top row, covering the orginal top frame. I am working using a mac and XCode, (cocoa-python project). Just as an additional poi

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Kent Johnson
On 8/16/08, Lie Ryan <[EMAIL PROTECTED]> wrote: > never use input(), use raw_input() instead. input() parses the string it > receives first, and may (read: WILL in the hands of certain persons) > allow user to input certain strings that get parsed into dangerous > codes. Use int(raw_input()) instea

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Lie Ryan
On Sat, 2008-08-16 at 16:07 +, Matti/Tritlo wrote: > I too am a Beginner at python, and i have been playing around with it > for about a week. While playing around, i decided to make a calculator > program (A Very simple one) to calculate area and also to convert > farenheit to celcius and vice

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Kent Johnson
On Sat, Aug 16, 2008 at 12:07 PM, Matti/Tritlo <[EMAIL PROTECTED]> wrote: Some quick notes: > print options() No need for the 'print' here, options() already prints. The extra print will print the return value of options(), which is None. > def triangle_area(width, height): > return width *

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Matti/Tritlo
I too am a Beginner at python, and i have been playing around with it for about a week. While playing around, i decided to make a calculator program (A Very simple one) to calculate area and also to convert farenheit to celcius and vice versa. So, here is the code: def options(): print "Optio

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Lie Ryan
On Sat, 2008-08-16 at 07:40 +0200, [EMAIL PROTECTED] wrote: > Message: 1 > Date: Fri, 15 Aug 2008 22:22:00 -0700 > From: "Joseph Bae" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is > not defined &g

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-16 Thread Kent Johnson
On Sat, Aug 16, 2008 at 1:22 AM, Joseph Bae <[EMAIL PROTECTED]> wrote: > convertTo == "C" and convertToCelsius(temp) or > convertToFahrenheit(temp) This idiom has a pitfall. Consider A and B or C If B can evaluate to a false value, such as None or 0, the expression will not do what

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Steve Willoughby
Joseph Bae wrote: Thanks for the help! I have managed to get a good temperature converter program working! I am working on beefing it up a bit with some exception handling and an "and-or trick". The error handling works okay but I am having problems using and-or. Here's my updated code: def mai

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Joseph Bae
Sorry! I copied the sample output from my command prompt incorrectly. Correct sample output: Enter A Number : 50 Convert to (F)ahrenheit or (C)elsius? C 50 Fahrenheit = 32 Celsius *50 *(not 32) Celsius = 147 Fahrenheit Joe On Fri, Aug 15, 2008 at 10:22 PM, Joseph Bae <[EMAIL PROTECTED]> wrote:

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-15 Thread Joseph Bae
Thanks for the help! I have managed to get a good temperature converter program working! I am working on beefing it up a bit with some exception handling and an "and-or trick". The error handling works okay but I am having problems using and-or. Here's my updated code: def main(): true = 1

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Alan Gauld
"Joseph Bae" <[EMAIL PROTECTED]> wrote temp = input("Enter A Number : ") convertTo = raw_input("Convert To (F)ahrenheit or (C)elsius? : ") if convertTo == "F": convertedTemp = convertToFahrenheit(temp) print "%d Celsius = %d Fahrenheit" % (temp, convertedTemp) else: convertedTemp = con

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Tuxicomane
Joseph Bae <[EMAIL PROTECTED]> writes: > Hi all, Hi ! (and sorry for my approximative English ... ;-) > I'm new to Python (and programming in general) and need some help! > > Here is my code so far for a temperature conversion program >(converts between Fahrenheit and Celsius): > > temp = input(

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Emad Nawfal (عماد نوفل)
On Thu, Aug 14, 2008 at 7:08 PM, Joseph Bae <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm new to Python (and programming in general) and need some help! > > Here is my code so far for a temperature conversion program (converts > between Fahrenheit and Celsius): > > > > temp = input("Enter A Number

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Josh Rosen
In Python, def is an executable statement. Your function is not defined until the def statement is run by Python. If you move your function definitions earlier in the code so that your functions are defined before they're used, this code will run properly. Josh R. On Aug 14, 2008, at 4:0

Re: [Tutor] beginner pexpect question

2008-02-13 Thread Nathan McBride
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Anyone have any recomendations? Seems like it is giving it the passwords since it finishes cleanly, but maybe not like I think? Nate Nathan McBride wrote: > Hey guys, > > I'm practically still a beginner with python. I am working on a program > tha

Re: [Tutor] Beginner in need

2008-02-11 Thread Kent Johnson
Artur Sousa wrote: > Sorry... forgot to add the code... > > 2008/2/11, Artur Sousa <[EMAIL PROTECTED] >: > > > Hi. Just started on programming, as well on Python. I'm having a > little problem: It helps if you describe the problem. If you are getting an error

Re: [Tutor] Beginner in need

2008-02-11 Thread Artur Sousa
Sorry... forgot to add the code... 2008/2/11, Artur Sousa <[EMAIL PROTECTED]>: > > > Hi. Just started on programming, as well on Python. I'm having a little > problem: > What's the difference between: > for n in range(2, 10): for x in range(2, n): if n % x == 0: pri

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-27 Thread Johnny Jelinek
Cairo does do it to files, but -- that's from your source. That's for if you draw something with python and then want to save it to an svg. It doesn't take something that's already an svg and convert it or display it. PIL will let me take advantage of all kind of graphical formats, but not any t

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Luke Paireepinart
Johnny Jelinek wrote: > how would I go about rendering an .svg to another file before showing > it on screen? Could you point me to some resources or examples? Thanks! You just mentioned that Cairo renders svgs to a file, didn't you? So can you just use pyCairo? Google would tell you of other py

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Johnny Jelinek
how would I go about rendering an .svg to another file before showing it on screen? Could you point me to some resources or examples? Thanks! On 6/26/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Johnny Jelinek wrote: > sure, I wouldn't mind looking at your code :D! Also, the graphical >

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Luke Paireepinart
Johnny Jelinek wrote: > sure, I wouldn't mind looking at your code :D! Also, the graphical > one you sent me was using gif's, do you know how to render svg's on > screen? The advantage to vector rather than raster is that you can > resize it as big as you could ever desire and it will never lo

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Johnny Jelinek
sure, I wouldn't mind looking at your code :D! Also, the graphical one you sent me was using gif's, do you know how to render svg's on screen? The advantage to vector rather than raster is that you can resize it as big as you could ever desire and it will never lose quality. That means I could

Re: [Tutor] beginner: using optional agument in __init__ breaks my code

2006-06-26 Thread Danny Yoo
>> The values of optional arguments are only once evaluated (when Python >> reads the definition). If you place there mutable objects like e.g. a >> list most of the time the effect you see is not what you want. So you >> have to write it a bit different. >> >> def __init__(self, q = None):

Re: [Tutor] beginner: using optional agument in __init__ breaks my code

2006-06-26 Thread Pawel Kraszewski
Dnia niedziela, 25 czerwca 2006 22:45, Bob Gailer napisał: > To get the behavior I think you want try: > > def __init__(self, q = None): > if not q: q = [] > self.queue = q I would disagree... This sure works for empty arguments, but: >>> u = [1,2,3] >>> a = Queue(u) >>> b =

Re: [Tutor] beginner: using optional agument in __init__ breaks my code

2006-06-25 Thread Barbara Schneider
--- Karl Pflästerer <[EMAIL PROTECTED]> schrieb: > > The values of optional arguments are only once > evaluated (when Python > reads the definition). If you place there mutable > objects like e.g. a > list most of the time the effect you see is not what > you want. So you > have to write it a bi

Re: [Tutor] beginner: using optional agument in __init__ breaks my code

2006-06-25 Thread Bob Gailer
Barbara Schneider wrote: > Hello Group, I am puzzled about this: The following > code implements a simple FIFO object. > > class Queue: > "Implementing a FIFO data structure." > > # Methods > def __init__(self): > self.queue = [] > > def emptyP(self): > return (s

Re: [Tutor] beginner: using optional agument in __init__ breaks my code

2006-06-25 Thread Karl Pflästerer
On 25 Jun 2006, [EMAIL PROTECTED] wrote: [...] > This code works as intended. Now my idea is to provide > an optional argument to the constructor. So I change > it to: > > def __init__(self, q =[]): > self.queue = q > > Now, something very strange happens: > a = Queue() b =

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

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

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 soluti

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 dea

  1   2   >