Re: [Tutor] Good approach regarding classes attributes

2014-09-11 Thread Brian van den Broek
On 7 September 2014 21:01, Danny Yoo d...@hashcollision.org wrote: snip Let's use a concrete example: say that we'd like to make sure a Person's name is always capitalized. We might try to enforce this capitalization property in the constructor. Hi all, rant on I've just again

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread Brian van den Broek
On May 7, 2014 7:30 PM, C Smith illusiontechniq...@gmail.com wrote: snip Someone suggested projecteuler.net and I started blazing through things I had done before, when I realized this would be a good time to start more efficient practices instead of code that just happens to work and may be

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread Brian van den Broek
On May 7, 2014 8:42 PM, C Smith illusiontechniq...@gmail.com wrote: I guess intuiting efficiency doesn't work in Python because it is such high-level? Or is there much more going on there? Hi, The level is a good part, yes. If, like me, you don't know what C constructs are under python

Re: [Tutor] sending email via SMTP: code review requested

2014-05-05 Thread Brian van den Broek
On 5 May 2014 13:53, Steven D'Aprano st...@pearwood.info wrote: On Sun, May 04, 2014 at 07:00:24PM -0400, Brian van den Broek wrote: Hi all, I am playing with the smtp and email modules from the standard library of Python 2.7.3 (I also want it to run on 2.6.6). I've not found the going easy

[Tutor] sending email via SMTP: code review requested

2014-05-04 Thread Brian van den Broek
Hi all, I am playing with the smtp and email modules from the standard library of Python 2.7.3 (I also want it to run on 2.6.6). I've not found the going easy; the SMTP and RFC 2822 standards are not ones I have worked with before. I have something that works, but I am not confident I am doing

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread Brian van den Broek
On May 4, 2014 8:31 PM, Jake Blank jakenbl...@gmail.com wrote: Hi, So I'm doing a problem on the Alice_in_wonderland.txt where I have to write a program that reads a piece of text from a file specified by the user, counts the number of occurrences of each word, and writes a sorted list of

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread Brian van den Broek
statement? I understand how i have to sort the words by their associated values i'm confused where in my code i would do that. Thanks, Jake On Sun, May 4, 2014 at 9:16 PM, Brian van den Broek brian.van.den.br...@gmail.com wrote: On May 4, 2014 8:31 PM, Jake Blank jakenbl...@gmail.com wrote

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread Brian van den Broek
On May 4, 2014 11:13 PM, Jake Blank jakenbl...@gmail.com wrote: To figure that last part out I just did a simple if statement. for k in sorted(word_count, key=lambda x:word_count[x], reverse=True): if word_count[k] =300: print (k, word_count[k]) And the output was

Re: [Tutor] Cantor pairing in three dimensions?

2013-12-25 Thread Brian van den Broek
On 24 December 2013 16:21, Brian van den Broek brian.van.den.br...@gmail.com wrote: On 23 December 2013 13:32, Danny Yoo d...@hashcollision.org wrote: I've got a puzzle: so there's a well-known function that maps the naturals N to N^2: it's called Cantor pairing: http://en.wikipedia.org

Re: [Tutor] Cantor pairing in three dimensions?

2013-12-24 Thread Brian van den Broek
On 23 December 2013 13:32, Danny Yoo d...@hashcollision.org wrote: I've got a puzzle: so there's a well-known function that maps the naturals N to N^2: it's called Cantor pairing: http://en.wikipedia.org/wiki/Pairing_function It's one of those mind-blowing things that I love. I ran

Re: [Tutor] [OT] Replies go to individuals, not the list?

2013-08-20 Thread Brian van den Broek
On Aug 20, 2013 3:04 PM, Andy McKenzie amckenz...@gmail.com wrote: On Tue, Aug 20, 2013 at 2:53 PM, Alan Gauld alan.ga...@btinternet.com wrote: On 20/08/13 13:15, Andy McKenzie wrote: Yep. Someone decided it didn't make sense for reply to go to the list that sent the message Lists never

Re: [Tutor] Clear screen questions

2013-05-05 Thread Brian van den Broek
On 5 May 2013 22:10, boB Stepp robertvst...@gmail.com wrote: On Sun, May 5, 2013 at 7:54 PM, Steven D'Aprano st...@pearwood.info wrote: snip So my main question is there a truly clean, cross-platform solution to the clear screen dilemma? If my online searching is accurate, then the

Re: [Tutor] Clear screen questions

2013-05-05 Thread Brian van den Broek
On 5 May 2013 23:12, Steven D'Aprano st...@pearwood.info wrote: On 06/05/13 12:37, Brian van den Broek wrote: snip Try: def pragmatic_as_if_clear(): print '\n' * 100 which isn't too far off of what clear does in bash. Not in the version of bash I am using in an xterm window

Re: [Tutor] creating dictionary from a list

2013-04-13 Thread Brian van den Broek
On 12 Apr 2013 21:25, Steven Dapos;Aprano st...@pearwood.info wrote: Also, you might find it easier to process the list if you strip out empty items. There are two simple ways to do it: lst = [x for x in list if x != ''] # or lst = filter(None, lst) Hi all, For the first, I would use lst

Re: [Tutor] Additional help

2013-02-10 Thread Brian van den Broek
On 10 February 2013 15:29, Ghadir Ghasemi ghasemm...@leedslearning.net wrote: Hi guys, I wondered if you knew what I could add to this code so that when the user enters 1 from the menu and then doesn't enter a valid binary number the program should ask them over and over again until valid

Re: [Tutor] using 'and ' and 'or' with integers

2013-01-09 Thread Brian van den Broek
On 9 January 2013 01:56, ken brockman krush1...@yahoo.com wrote: I was looking through some lab material from a computer course offered at UC Berkeley and came across some examples in the form of questions on a test about python. 1 and 2 and 3 answer 3 I've goggled it till i was red in the

Re: [Tutor] writing effective unittests

2013-01-04 Thread Brian van den Broek
On 4 January 2013 03:34, Alan Gauld alan.ga...@btinternet.com wrote: On 04/01/13 07:10, Brian van den Broek wrote: ... confirm that the code works as intended when written, but that it continues to work several moths later moths? They'll be the bugs I guess? Sorry I couldn't resist

Re: [Tutor] writing effective unittests

2013-01-03 Thread Brian van den Broek
On 3 January 2013 14:46, Luke Thomas Mergner lmerg...@gmail.com wrote: * Albert-Jan Roskam fo...@yahoo.com wrote: Hi, I am trying to learn a bit of test-driven programming using unittests and nosetests. I am having trouble finding resources that explain how to write effective tests.

Re: [Tutor] still confused about for loops

2012-12-19 Thread Brian van den Broek
On 19 December 2012 01:19, Brandon Merritt merrit...@gmail.com wrote: Sorry, I am just so confused and aggravated as to why this won't work - why doesn't it print out the whole list? : number = raw_input('Enter a 7-unit number: ') for i in number: count = [] count.append(i) print

[Tutor] Fwd: Re: Tutor Digest, Vol 106, Issue 31

2012-12-14 Thread Brian van den Broek
Forwarding to the list what I sent privately. Stupid android UI. -- Forwarded message -- From: Brian van den Broek brian.van.den.br...@gmail.com Date: 14 Dec 2012 10:01 Subject: Re: [Tutor] Tutor Digest, Vol 106, Issue 31 To: Waters, Mike [ITSCA Non-JJ] mwat...@its.jnj.com On 14

Re: [Tutor] reverse diagonal

2012-12-01 Thread Brian van den Broek
On 1 December 2012 10:40, richard kappler richkapp...@gmail.com wrote: I'm working through Mark Lutz's Python, reviewing the section on lists. I understand the list comprehension so far, but ran into a snag with the matrix. I've created the matrix M as follows: M = [[1, 2, 3[, [4, 5, 6], [7,

Re: [Tutor] reverse diagonal

2012-12-01 Thread Brian van den Broek
On 1 December 2012 20:12, Dave Angel d...@davea.name wrote: On 12/01/2012 11:28 AM, Brian van den Broek wrote: On 1 December 2012 10:40, richard kappler richkapp...@gmail.com wrote: I'm working through Mark Lutz's Python, reviewing the section on lists. I understand the list comprehension so

Re: [Tutor] run with default value if input not given

2012-10-29 Thread Brian van den Broek
On 29 Oct 2012 02:30, Saad Javed sbja...@gmail.com wrote: I've come up with this: try: sys.argv[1] x = sys.argv[1] main(x) except IndexError: main(x) It works but seems hackish. Saad Saad, The first sys.argv is not needed. Notice how i have replied below the text i am quoting? That

Re: [Tutor] urllib2.urlopen()

2012-10-14 Thread Brian van den Broek
On 14 October 2012 02:15, Ray Jones crawlz...@gmail.com wrote: On 10/13/2012 07:50 PM, Steven D'Aprano wrote: snip If you can do `print e.info()`, then you can also do `info = e.info()` and inspect the info programmatically. One would expect that to be true. But when I do info = e.info(),

Re: [Tutor] urllib2.urlopen()

2012-10-13 Thread Brian van den Broek
On 13 October 2012 19:44, Ray Jones crawlz...@gmail.com wrote: I am attempting to capture url headers and have my script make decisions based on the content of those headers. Here is what I am using in the relative portion of my script: try: urllib2.urlopen('http://myurl.org') except

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Brian van den Broek
On 6 Oct 2012 22:40, Richard D. Moores rdmoo...@gmail.com wrote: snip I remain bewildered. Where did these strangely named things come from, strftime and strptime? I see that Hi Dick, These names carry over from well entrentched names from C. My guess is format time and print time are what

Re: [Tutor] MAXIMUM LOOP LOGIC

2012-10-04 Thread Brian van den Broek
On 4 Oct 2012 13:22, medusa magicwizards...@gmail.com wrote: Hello i got stuck with the last bit of my programming practice. snip Instead of printing off a number beside the email, i got another email and i dont know how to fix it. http://python.6.n6.nabble.com/file/n4990842/9.4_stuck.png

Re: [Tutor] Why difference between printing string typing its object reference at the prompt?

2012-10-02 Thread Brian van den Broek
On 2 Oct 2012 23:17, boB Stepp robertvst...@gmail.com wrote: snip I am puzzled by the results of the following: x = Test x 'Test' print(x) Test I understand that 'Test' is the stored value in memory where the single quotes designate the value as being a string data type. So it

Re: [Tutor] html checker

2012-10-01 Thread Brian van den Broek
On 1 Oct 2012 15:28, Matthew Dalrymple computer_dud...@hotmail.com wrote: I don't need to hear how bad my programs are...either you are gonna help or your not...if Matthew, Bob didn't cuddle you and he may have been a bit more brusque than you'd have liked. However, his response to you was

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-10-01 Thread Brian van den Broek
On 30 September 2012 04:37, Alan Gauld alan.ga...@btinternet.com wrote: off topic rant One of the things that makes math hard for people to grasp is its insistence on abstracting functions/values to single letter names etc. (especially when those names are in a foreign language/symbology,

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-10-01 Thread Brian van den Broek
On 1 October 2012 19:30, Alan Gauld alan.ga...@btinternet.com wrote: translation for them, not just complain of their 'ignorance'. But that's now taking things way, way off topic!! :-) I think you meant ``way^2 off topic'' ;-) Brian vdB ___ Tutor

Re: [Tutor] HELP!

2012-10-01 Thread Brian van den Broek
On 1 Oct 2012 19:58, Mark Rourke mark.rour...@gmail.com wrote: hello, I am a college student in my first year of computer programming, I was wondering if you could look at my code to see whats wrong with it. # Mark Rourke # Sept 29, 2012 # Write a program to calculate the sales tax at the

Re: [Tutor] running more than one python program at the same time

2012-08-28 Thread Brian van den Broek
On 28 Aug 2012 18:33, Benjamin Fishbein bfishbei...@gmail.com wrote: Hello, I wrote a program that I want to have running 24/7. But the problem is that I also want to write and run other programs. I'm using Idle and it won't let me run more than one script at a time. Do you know if there's a

Re: [Tutor] How to print something just after 3 attempts?

2012-07-17 Thread Brian van den Broek
On 17 Jul 2012 12:39, Mark Lawrence breamore...@yahoo.co.uk wrote: On 17/07/2012 16:28, Paul McNally wrote: snip enough context to perhaps have lost attributions I was able to get it working like this... password = foobar attempt = 0 while (password != unicorn) and (attempt = 3):

Re: [Tutor] str object is not callable

2012-07-10 Thread Brian van den Broek
On 10 Jul 2012 11:31, Chris Hare ch...@labr.net wrote: This piece of code works: Big-Mac:Classes chare$ more tmp.py import re snip return not bool(search(string)) snip However, when I use the EXACT same code in the context of the larger code, I get the error return not

Re: [Tutor] Meaningless

2012-05-27 Thread Brian van den Broek
On 27 May 2012 20:52, Dave Angel d...@davea.name wrote: On 05/27/2012 01:03 PM, Kimberly McManus wrote: help Sure. Head for the nearest exit, stopping before each door to make sure it's not hot before opening it. Hi Kimberly, While I share Dave's sadness at the general decline of

[Tutor] [OT] Re: Optimally configuring Emacs for W7-64bit and Python

2012-05-27 Thread Brian van den Broek
On 23 May 2012 05:17, boB Stepp robertvst...@gmail.com wrote: but I will not be able to provide much (any?) help in the immediate future. (If emacs seems like you will stick to it, do have a look at orgmode.) Brian, does org-mode amount to a personal information manager? What are the

Re: [Tutor] Optimally configuring Emacs for W7-64bit and Python

2012-05-22 Thread Brian van den Broek
On 22 May 2012 06:58, boB Stepp robertvst...@gmail.com wrote: Many thanks for all of the helpful input to my original questions. The deciding factors came down to the fact that GNU Emacs, vintage year 2001, is available on the Sun Blade at work, I already own the book Learning GNU Emacs and

[Tutor] [OT] Re: While learning Py: To IDE or not to IDE?

2012-05-21 Thread Brian van den Broek
On 21 May 2012 03:39, Steven Dapos;Aprano st...@pearwood.info wrote: boB Stepp wrote: snip now on learning an IDE if it will save me time overall. IF it would be beneficial now to learn an IDE, then it begs the question No it doesn't. It RAISES the question -- begging the question means

Re: [Tutor] While learning Py: To IDE or not to IDE?

2012-05-21 Thread Brian van den Broek
On 21 May 2012 01:19, boB Stepp robertvst...@gmail.com wrote: On Sun, May 20, 2012 at 4:44 PM, Brian van den Broek brian.van.den.br...@gmail.com wrote: snip With you polyglot agenda, I would say you would be much better off to learn a powerful multipurpose editor well than to try to find

Re: [Tutor] While learning Py: To IDE or not to IDE?

2012-05-20 Thread Brian van den Broek
On 20 May 2012 23:04, boB Stepp robertvst...@gmail.com wrote: snip Goals: Learn Python. While learning Python, learn all of the good C.Sc. stuff that I should have learned the first go-around, Learn Java and C/C++. Reevaluate. snip Finally to the question: With the stated goals above,

Re: [Tutor] How to read blog posts in python

2012-05-17 Thread Brian van den Broek
On 17 May 2012 16:31, Surya K sur...@live.com wrote: Hi, I want to write a python code which read blog's RSS/ Atom feeds and gives us the all post's content of blog... I am currently trying to use FeedParser (Universal Feed Parser). I am able to get all post's titles and URL's but not a

Re: [Tutor] Sorting the Parts of a Dictionary into a List

2012-05-08 Thread Brian van den Broek
On 8 May 2012 23:23, Jacob Bender benderjaco...@gmail.com wrote: Dear Tutors, My original email was this: Dear tutors, I'm trying to create a neural network program. Each neuron is in a dictionary and each of its connections and their strengths are in a nested dictionary. So {0:{1:4,

Re: [Tutor] which gets called

2012-04-06 Thread Brian van den Broek
On 6 April 2012 15:54, John Fabiani jo...@jfcomputer.com wrote: Hi, I want to create a class that inherits two other classes. class NewClass( A,B) But both A and B contain a method with the same name (onKeyDown). If my NewClass does not contain something to override the methods which one

Re: [Tutor] How is the return statement working in this function?

2012-04-05 Thread Brian van den Broek
On 6 Apr 2012 02:43, Greg Christian glchrist...@comcast.net wrote: I am just wondering if anyone can explain how the return statement in this function is working (the code is from activestate.com)? Where does x come from – it is not initialized anywhere else and then just appears in the return

Re: [Tutor] Any book to study Python

2012-03-19 Thread Brian van den Broek
On 19 Mar 2012 11:42, Yan, Xianming xianming@intercallapac.com wrote: I'm following http://docs.python.org/tutorial/interpreter.html to type in the first script into python. According to the link, I typed below: the_world_is_flat = 1 if the_world_is_flat: ... print Be careful not

Re: [Tutor] seeing the results of a python program in windows7

2012-03-15 Thread Brian van den Broek
On 15 Mar 2012 04:14, bob gailer bgai...@gmail.com wrote: On 3/14/2012 12:12 PM, Tamar Osher wrote: I can run a python program in Notepad++, but what happens is that the black box flashes and disappears immediately, so that I never see the results. How can I style it so that the results of

Re: [Tutor] Cannot run python programs on my windows7 computer

2012-03-14 Thread Brian van den Broek
On 14 Mar 2012 02:56, Tamar Osher emeraldoff...@hotmail.com wrote: Hello. Is there someone who can tutor me about how to run Python files on my windows7 computer? I have IDLE (the white box, the Python shell). I have the command prompt (the black box). And I also have Notepad++ on my

Re: [Tutor] return integer from function

2012-02-22 Thread Brian van den Broek
On 22 February 2012 12:57, David Craig dcdavem...@gmail.com wrote: Hi, I have a function that calculates the distance between two points on a sphere. It works but I cant get it to return a float for use in another script. Anyone know how I do that?? snip code    cos =

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 15:28, William Stewart williamjstew...@rogers.com wrote: I am trying to get 2 string variables and 2 integer variables to be able to be multiplied can anyone tell me what I did wrong str1 = raw_input(Type in a String: ) str2 = raw_input(Type in a String: ) int1 =

Re: [Tutor] exercise with classes 2nd attempt

2012-02-12 Thread Brian van den Broek
On 12 Feb 2012 05:23, Tonu Mikk tm...@umn.edu wrote: I am learning Python using the Learn Python the Hard Way book by Zed Shaw. I reached exercise 42 where we learn about Python classes. The exercise shows a game with one class that includes all the definitions for playing the game. For extra

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
van den Broek brian.van.den.br...@gmail.com wrote: From: Brian van den Broek brian.van.den.br...@gmail.com Subject: Re: [Tutor] string integers? To: William Stewart williamjstew...@rogers.com Cc: tutor@python.org Date: Sunday, February 12, 2012, 8:53 AM On 12 Feb 2012 15:28, William

Re: [Tutor] string integers?

2012-02-12 Thread Brian van den Broek
On 13 February 2012 01:34, William Stewart williamjstew...@rogers.com wrote: this is the code I have str1 = raw_input(Type in a String: ) str2 = raw_input(Type in a String: ) int1 = raw_input(Type in a integer variable: ) int2 = raw_input(Type in a integer variable: ) print str1 + str2 +

Re: [Tutor] Learn Python The Hard Way, Ex19-3

2012-02-11 Thread Brian van den Broek
On 12 Feb 2012 00:29, amt 0101...@gmail.com wrote: Hello! I'm currently stuck at the Extra Credit 3 from LPTHW. Link to the actual exercise: http://learnpythonthehardway.org/book/ex19.html The exercise: Write at least one more function of your own design, and run it 10 different ways.

Re: [Tutor] How to make def where arguments are either stated when called or entered via raw_input

2012-02-09 Thread Brian van den Broek
On 9 Feb 2012 13:34, David Craig dcdavem...@gmail.com wrote: Hi, I'm trying to write a function that will either take arguments when the function is called, such as myFunc(x,y,z) or if the user does not enter any arguments, myFunc() the raw_input function will ask for them. But I dont know how

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Alan Gauld said unto the world at 14/01/09 07:34 PM: Brian van den Broek van...@gmail.com wrote icon for Idle launching as expected. When run from IDLE, `print sys.executable' yields `C:\\Python26\\pythonw.exe'. He reports that C:\Python26 contains both python.exe and pythonw.exe. I've had

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Brian van den Broek said unto the world at 15/01/09 11:27 AM: Alan Gauld said unto the world at 14/01/09 07:34 PM: Brian van den Broek van...@gmail.com wrote snip my account of Windows using friend unable to invoke python at DOS prompt and replies including Alan's suggestion to get a text

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Kent Johnson said unto the world at 15/01/09 12:33 PM: On Thu, Jan 15, 2009 at 11:48 AM, Brian van den Broek br...@cc.umanitoba.ca wrote: The (recognized by me as) relevant bits of output are: Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\texlive\2008\bin\win32;C

[Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Brian van den Broek
Hi all, I'm trying, via email, to help a friend set up python on his Windows XP computer. I've been strictly linux for some time now, and don't have a Windows machine on which to investigate. We've hit a problem, and I'd appreciate a push. He's got python 2.6.1 installed as evidenced by the

[Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Brian van den Broek
Hi all, I'm trying, via email, to help a friend set up python on his Windows XP computer. I've been strictly linux for some time now, and don't have a Windows machine on which to investigate. We've hit a problem, and I'd appreciate a push. He's got python 2.6.1 installed as evidenced by the

Re: [Tutor] Key Error

2007-07-08 Thread Brian van den Broek
Sara Johnson said unto the world upon 07/08/2007 01:34 AM: Sorry, this is probably too general a question, but I can't find any specific information on it. What exactly is a key error and how do I clear it? I entered something like this: abcd=h[key]['ABCD'] and when I run it I'm

Re: [Tutor] Money matters

2007-06-28 Thread Brian van den Broek
Terry said unto the world upon 06/28/2007 02:55 PM: I am going to need to be handling money calculations and was wondering about the float problem in my calculations. Should I simply run the results of all calculations through something like this: from __future__ import division ...

[Tutor] subprocess and launching an editor

2007-06-22 Thread Brian van den Broek
Hi all, I want to have a script launch an editor open to a particular file and wait until that editor has closed before continuing. The aim is to allow the user to make edits to the file, have to script know that the edits are completed, and then make use of the newly saved file contents.

Re: [Tutor] More trouble debugging my game of life program

2007-06-03 Thread Brian van den Broek
Matt Smith said unto the world upon 06/03/2007 04:12 PM: Hi, I've got my program working correctly (or so it seems) with my original data file (r-pentomino.txt - attached) but when I run it with a larger (30*30) file (big-r-pentomino - also attached) in an attempt to make it work with out

Re: [Tutor] Design Question

2007-06-01 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 06/01/2007 10:46 AM: I think I may have sent an incomplete version of this question a moment ago (sorry). Here is the complete question: I'm designing something along the lines of a flash card program. It's mostly just an exercise in learning

Re: [Tutor] [Fwd: Re: trouble with if]

2007-05-30 Thread Brian van den Broek
Adam Urbas said unto the world upon 05/30/2007 11:01 AM: I can't exactly show you the error message anymore, because the program is now screwed up in so many ways that I can't even get it to do the things it used to. It says things like ERROR: Inconsistent indentation detected! 1) Your

Re: [Tutor] trouble with if

2007-05-29 Thread Brian van den Broek
adam urbas said unto the world upon 05/29/2007 12:39 PM: The scary part is, I think I understand this. I copied your last example and put it in IDLE and it doesn't like you code. Never mind. I figured it out. So that is so it will notify you if your choice is invalid. Nice lil tidbit of

[Tutor] [Fwd: Re: trouble with if]

2007-05-29 Thread Brian van den Broek
to reply to the list and the original sender rather than just the sender. Best, Brian vdB Original Message Subject: Re: [Tutor] trouble with if Date: Tue, 29 May 2007 23:07:57 -0500 From: Adam Urbas [EMAIL PROTECTED] To: Brian van den Broek [EMAIL PROTECTED] References: [EMAIL

Re: [Tutor] trouble with if

2007-05-27 Thread Brian van den Broek
adam urbas said unto the world upon 05/27/2007 01:49 PM: Thank you for the help Brian. I would like to ask you about these things. Which one of the examples you gave would be most fool proof. snip of all previous exchanges which are too badly formatted to be readable Hi Adam and all,

Re: [Tutor] trouble with indents

2007-05-27 Thread Brian van den Broek
adam urbas said unto the world upon 05/28/2007 12:24 AM: Thanks for the clarification, but I'm still a tad confused. I'm not sure when to indent. I understand that it has to be done. That link was really confusing. Very newb non-friendly. Arrg... That site is doom. So confusing. I need

Re: [Tutor] trouble with if

2007-05-23 Thread Brian van den Broek
adam urbas said unto the world upon 05/23/2007 11:57 AM: Hi all, I've been working with this new program that I wrote. I started out with it on a Ti-83, which is much easier to program than python. Now I'm trying to transfer the program to python but its proving to be quite

Re: [Tutor] trouble with if

2007-05-23 Thread Brian van den Broek
adam urbas said unto the world upon 05/23/2007 01:04 PM: Sorry, I don't think Hotmail has turn off HTML. If it does I havn't been able to find it. I think you're going to have to explain your little bit of text stuff down there at the bottom. I have no idea what most of that means. All my

Re: [Tutor] Rounding to nearest cent

2007-05-22 Thread Brian van den Broek
Jessica Brink said unto the world upon 05/22/2007 09:08 AM: How would I round to the nearest cent when doing calculations with dollar amounts? -Jess Hi Jess, The decimal module was introduced in large part to facilitate financial calculations. Have a look at

Re: [Tutor] Function for converting ints from base10 to base2?

2007-02-21 Thread Brian van den Broek
Dick Moores said unto the world upon 02/21/2007 08:08 PM: At 05:17 PM 2/21/2007, Terry Carroll wrote: snip I like the approach of mapping hex or octal digits posted by Alan and Bob, but, not thinking of that, this would be my straightforward approach: def computeBin(n): converts

Re: [Tutor] shebang problem

2006-11-05 Thread Brian van den Broek
Alan Gauld said unto the world upon 11/04/2006 06:47 PM: [EMAIL PROTECTED]:~/test$ ls -la shebangtest.py -rwxr-xr-- 1 brian brian 68 2006-11-04 02:29 shebangtest.py so the file is called shebangtest.py... [EMAIL PROTECTED]:~/test$ shebangtest bash: shebangtest: command not found but

[Tutor] shebang problem

2006-11-04 Thread Brian van den Broek
Hi all, I'm still getting comfortable with Linux and this might be an OS rather than a python problem. I am trying to make a script directly executable. I've reviewed the 2nd ed of the Nutshell, and I cannot work out what I'm doing wrong. I'm running ubunutu 6.10 (edgy eft). Here's a copy past

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Brian van den Broek
Asrarahmed Kadri said unto the world upon 19/10/06 12:55 PM: My algorithm is like this: first count the number of lines in the file by using a loop. Use a second loop and when teh counter reaches the num_of_lines values: take the line. Is there any other way to do it?? On 10/19/06,

Re: [Tutor] What is a Python project?

2006-10-03 Thread Brian van den Broek
Dick Moores said unto the world upon 03/10/06 01:41 PM: At 10:01 AM 10/3/2006, Mike Hansen wrote: snip Dick asking about the point of projects in Wing IDE and Mike replying I've been doing some web programming, so my projects consist of cheetah template files, CSS, config files, a handful of

Re: [Tutor] folder and module

2006-09-17 Thread Brian van den Broek
linda.s said unto the world upon 17/09/06 02:03 PM: snip I checked sys.path and environemntal variables: since the desktop directory is not listed in either of them, why there is no error report when I import a module which is in the desktop into test.py which is under a different folder?

Re: [Tutor] Lists in lists

2006-09-17 Thread Brian van den Broek
Kent Johnson said unto the world upon 16/09/06 07:49 PM: Brian van den Broek wrote: Kent Johnson said unto the world upon 16/09/06 04:35 PM: Brian van den Broek wrote: You say you are new to Python. Well, it might not now be obvious why dictionaries are especially useful

Re: [Tutor] Lists in lists

2006-09-16 Thread Brian van den Broek
Morten Juhl Johansen said unto the world upon 16/09/06 08:29 AM: # Newbie warning I am making a timeline program. It is fairly simple. I base it on appending lists to a list. Ex. [[year1, headline1, event text1], [year2, headline2, event text2]] This seemed like a brilliant idea when I did

Re: [Tutor] Lists in lists

2006-09-16 Thread Brian van den Broek
Kent Johnson said unto the world upon 16/09/06 04:35 PM: Brian van den Broek wrote: Morten Juhl Johansen said unto the world upon 16/09/06 08:29 AM: # Newbie warning I am making a timeline program. It is fairly simple. I base it on appending lists to a list. Ex. [[year1, headline1, event

[Tutor] [OT] Re: Limiting Characters

2006-08-22 Thread Brian van den Broek
user name, except when it doesn't ;-) Brian van den Broek ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread Brian van den Broek
Danny Yoo said unto the world upon 17/08/06 12:16 PM: Suggest an alternative way of transmitting code. Hi Kermit, snip Just as a side note: you may want to investigate a good email client such as Thunderbird if you have spare time. http://www.mozilla.com/thunderbird/ Much of

Re: [Tutor] Which Book

2006-08-17 Thread Brian van den Broek
Nagendra Singh said unto the world upon 17/08/06 12:14 PM: Hi All, I have very little programming experience, I have decided to learn Python..there are tons of material and refernces on the web-pages, can you guys please suggest what is the best way to start or which ONE book which I should

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread Brian van den Broek
Kermit Rose said unto the world upon 17/08/06 02:38 PM: Now if I can only get Thunderbird to quit treating the up and down arrow as a page up or page down, whenever it's at the top line or bottom line of what it thinks is a page. Hi Kermit, I'm glad you've given Thunderbird a try and that

Re: [Tutor] help regarding forms... (fwd)

2006-08-08 Thread Brian van den Broek
Alan Gauld said unto the world upon 08/08/06 12:59 PM: I've been on the internet for over 20 years now and every mail tool/newreader I've ever used has (at least) two reply options: ... I don't understand why this seems to come as a surprise? What am I missing? Alan, I think you are judging

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Brian van den Broek
Alan Gauld said unto the world upon 07/08/06 04:43 PM: this list is setup to send to the poster by default. I made the mistake of doing such a thing earlier myself. I know this is a huge item of contention, but do people favor having the default be to send replies to the list? OK, I've got

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Brian van den Broek
Danny Yoo said unto the world upon 31/03/06 08:27 PM: Then, the output is like so: atoms = [a,b,c] tvas = tva_dict_maker(atoms) display_tvas(tvas) a:Trueb:True c:True a:Trueb:True c:False a:Trueb:False c:True a:Trueb:False c:False a:False b:True

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Brian van den Broek
Orri Ganel said unto the world upon 01/04/06 03:04 PM: Brian van den Broek wrote: snip Then, the output is like so: atoms = [a,b,c] tvas = tva_dict_maker(atoms) display_tvas(tvas) a:Trueb:Truec:True a:Trueb:Truec:False a:Trueb:Falsec:True a:True

Re: [Tutor] Logical Operaor

2006-04-06 Thread Brian van den Broek
Kaushal Shriyan said unto the world upon 06/04/06 08:06 AM: Hi I am referring to http://www.ibiblio.org/obp/thinkCSpy/chap04.htm about Logical operators I didnot understood x = 5 x and 1 1 y = 0 y and 1 0 How 5 and 1 means 1 and 0 and 1 means 0 Thanks Regards

Re: [Tutor] request for sugestions on fragement of code for generating truth-tables

2006-04-06 Thread Brian van den Broek
Danny Yoo said unto the world upon 06/04/06 04:38 PM: snip Yes, I agree that the readability of the code is primary. Understandng the recursive approach depends on the reader's comfort with recursive functions, and the non-recursive code depends on the reader's comfort with arithmetic

Re: [Tutor] 'in-place' methods

2006-02-18 Thread Brian van den Broek
Michael Broe said unto the world upon 17/02/06 03:57 PM: snip Second question. Do I really have to write the sort_print() function like this: def sort_print(L): L.sort() print L i.e. first perform the operation in-place, then pass the variable? Is this the

Re: [Tutor] problems with the shebang line and linux

2006-02-17 Thread Brian van den Broek
Thanks to all for the replies. Indeed, it must have been the DOS vs. Unix line terminators as several people suggested. A couple of comments in-line below. Roel Schroeven said unto the world upon 16/02/06 11:14 AM: On 16/02/06, *Brian van den Broek* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED

[Tutor] problems with the shebang line and linux

2006-02-16 Thread Brian van den Broek
Hi all, I've switched to Linux fairly recently and am still at the fumbling about stage :-) I'm having a devil of a time with the shebang line and running a py file from a command line. I wrote the following little test script with IDLE 1.1.2 under Python 2.4.2 on Ubuntu 5.10: code

Re: [Tutor] problems with the shebang line and linux

2006-02-16 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 16/02/06 08:22 AM: bash: ./testerlybar.py: /usr/bin/python^M: bad interpreter: No such file or directory [EMAIL PROTECTED]:/media/windata$ Note the ^M the additional fileformat character inserted. That is causing the problem. Instead of copying

Re: [Tutor] tutorials

2006-01-16 Thread Brian van den Broek
catherine curley said unto the world upon 16/01/06 08:26 AM: Hi Has anyone got an easy way of printing the Python documentation in PDF format. Its all in HTML and is time consuming to print. Catherine pdf format is available here: http://docs.python.org/download.html. Best, Brian vdB

Re: [Tutor] Finding the Index of a member of a Tuple

2006-01-11 Thread Brian van den Broek
bob said unto the world upon 11/01/06 10:47 PM: At 08:31 PM 1/11/2006, Steve Haley wrote: Hello everyone, I need to do something very simple but I'm having trouble finding the way to do it - at least easily. I have created a tuple and now need to find the position of individual members of

Re: [Tutor] Locating directory of script?

2006-01-11 Thread Brian van den Broek
Liam Clarke said unto the world upon 12/01/06 12:32 AM: Hi all, Let's say I have a script called bob.py in a directory called c:\pythonstuff, which is in my PATH env_var, and python is also in my PATH, and from a completely different directory I call python bob.py is there a right way to

Re: [Tutor] declaring list in python

2006-01-10 Thread Brian van den Broek
Logesh Pillay said unto the world upon 10/01/06 11:28 PM: Hello list I want to declare a list of a specific size as global to some nested function like so Hi Logesh, what problem are you trying to solve by doing this? Knowing that will help generate more useful answers, I suspect.

  1   2   3   >