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

[Tutor] Beginner Level Projects

2018-04-19 Thread Joshua Nghe
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 what I learned. I currently have around 10 hours spent learning Py

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

[Tutor] Beginner: Socket object and packets

2015-12-05 Thread Marc Eymard
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. My assumption is there will be a mandatory blank line right after the http headers in accordance with the http protocol. Consider the following: import s

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

[Tutor] Beginner - list not returning correct variable value

2014-03-13 Thread Marc Eymard
Hello Tutor, I am a self-taught Python script beginner and I do it from the Michael Dawson Book. 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

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

[Tutor] Beginner - Clarifying 'understanding randint arguments'

2014-02-17 Thread Marc Eymard
Hi Tutor, The previous elements I sent to the mailing list were incomplete and needs no answer from Tutor. To clarify and re-phrase my script issue: I want to code a game whereby the computer guesses either by luck or deduction a number I pick within [0, 100]. In attached machine_guess_number

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

[Tutor] Beginner - understanding randint arguments

2014-02-15 Thread Marc Eymard
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 range each time the function is called excludi

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

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

2014-02-12 Thread Marc Eymard
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, either returned values are wrong or the script seems to enter in an infin

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 "

[Tutor] Beginner question on classes

2013-10-23 Thread Corinne Landers
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): for k in range(z): animal = program.animal() if animal:

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

[Tutor] Beginner Question

2013-10-22 Thread Sven Hennig
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 every book I've read are the examples of such C

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

[Tutor] Beginner question

2013-08-11 Thread eschneider92
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 see two caves. In one cave, the dragon is friendly')

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

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

2013-05-19 Thread Rafael Knuth
Hello, here's a tiny little program I wrote: import random print(""" This is a magic super computer. He will ask you a couple of questions. An ultra-complicated algorithm will then figure out what your favorite meal is. """) name = str(input("What is your name? ")) age = int(input("How old

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

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

2012-09-09 Thread Aaron Pilgrim
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 for Professionals by Professionals) (Kindle L

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.

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

2011-12-20 Thread Homme, James
Hi, Please don't give me the answer. Please tell me where to read to find out. So far, the data types this little book has talked about are strings and numbers. The book is here. http://learnpythonthehardway.org/book/ I cut out the parts of the program I definitely understand to focus on this

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

[Tutor] beginner here

2011-12-07 Thread Do youknow who
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 # Demonstrating the While loop import random print("I will flip a coin 100 times and tell you") print(", how man

[Tutor] Beginner Programming Challenges

2011-11-20 Thread Bod Soutar
FOA: Any aspiring new programmers looking for some inspiration or projects. There is a series of programming challenges being run on the ubuntu forums The challenges are aimed at beginners, and although they assume you are running linux, this is not always a requirement.

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

[Tutor] beginner question

2011-11-01 Thread Mayo Adams
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 lines? -- Mayo Adams

Re: [Tutor] Beginner troubleshooting py2exe

2011-06-27 Thread delegbede
point you in the direction to go. Regards. Sent from my BlackBerry wireless device from MTN -Original Message- From: Esther Showalter Sender: tutor-bounces+delegbede=dudupay@python.org Date: Mon, 27 Jun 2011 18:27:10 To: Subject: [Tutor] Beginner troubleshooting py2exe

[Tutor] Beginner troubleshooting py2exe

2011-06-27 Thread Esther Showalter
Hello! I'm trying to follow the introductory tutorial on using py2exe at http://py2exe.org/index.cgi/Tutorial. It's very straightforward except that I keep getting an error when I come to step #3 and I don't know what I need to do about it: I'm running Python 2.7 on Windows Vista (32-bit). I've i

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

[Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Lisi
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 2 3 script, user_name = argv I have tried every permutation of wh

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

[Tutor] Beginner needs help with tkinter and images

2011-05-17 Thread Adam Westrum
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 appears, but the first picture rem

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

[Tutor] Beginner issue with Tkinter Listbox

2008-09-03 Thread David Johnson
I have just started learning Python and have moved on to learning about Tkinter. This is likely to be a very easy question but I have no idea what is happening here. I am trying to set up a GUI, separated into several frames. In a lower frame I have added a Listbox. I want the first item

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(

  1   2   >