Re: [Tutor] Will the following code ever exit?

2005-09-17 Thread Andre Engels
On 9/17/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Thanks, but when I run the code, even after that change it always just > prints the questions, correct questions(which is always 0), and percent > right(always 0). How do I make it enter the quiz. > Thanks, > Nathan Pinno Your program has: q =

Re: [Tutor] Will the following code ever exit?

2005-09-17 Thread Alan G
Nathan, > Will the following code ever exit, Yes, it will exit - with an error because it can never run. def add(a,b): answer = a+b guess = float(raw_input(a," + ",b," = ")) You never return the answer so it dies when the function dies. num1 = random.choice(range(1,10)) num2 = random.

Re: [Tutor] Why won't it enter the quiz? (off topic)

2005-09-17 Thread Alan G
>> PS> No, (for the record only), there is a HUGE difference between >> selling "skills" and selling code that someone else wrote. :-D >> > Once again you're implying that there's something wrong with Nathan > asking for help on this list. Blow it out your hairdo... Technically there may be so

Re: [Tutor] Getting rid of the newline in file

2005-09-17 Thread Alan G
> f = file("foo", 'w') Using 'w' will destroy the contents of the file, I assume you are really using 'r'? > fileContents = f.readlines() Each line will be terminated by a newline, you can use rstrip() to remove it: > print fileContents[0].rstrip() + "Hi!" HTH, There is more on this topic i

Re: [Tutor] How do fix this error?

2005-09-17 Thread Alan G
Traceback (most recent call last): File "D:\Python24\add_tutor.py", line 18, in -toplevel- answer, guess = add(num1,num2) File "D:\Python24\add_tutor.py", line 5, in add guess = float(raw_input(a," + ",b," = ")) TypeError: [raw_]input expected at most 1 arguments, got 4 The error tells

Re: [Tutor] GetGarf (sorry, this time with attachment)

2005-09-17 Thread Joseph Quigley
Ismael wrote: >Do you know about Dosage? It downloads lots of comics (around 500 - of >course, you choose which ones). Among those, there's Garfield. It's >"catchup" option will download past comics for you, and even generate >RSS feeds and html pages if you wish to. > >http://slipgate.za.net/d

Re: [Tutor] Getting rid of the newline in file

2005-09-17 Thread Joseph Quigley
Alan G wrote: >> f = file("foo", 'w') > > > Using 'w' will destroy the contents of the file, I assume you are > really using 'r'? Ah yes.. sorry. > > Each line will be terminated by a newline, you can use rstrip() to > remove it: > >> print fileContents[0].rstrip() + "Hi!" > Thanks a lot! This

Re: [Tutor] Why won't it enter the quiz? (off topic)

2005-09-17 Thread Poor Yorick
Alan G wrote: > > Technically there may be something wrong in that if he is > claiming copyright and selling for commerxcial gain rather > than selling it as open source he has to prove that he Then I recommend that Byron and anyone else interested in this stuff go browse http://www.benedict.c

[Tutor] Python Puzzles

2005-09-17 Thread J.Gabriel Schenz
Hello all. I recently returned home from overseas. While I was overseas, I was not able to access the Internet very often, although I recall seeing at some point that there was a collection of Python puzzles that one could work on, and in order to move on to the next puzzle one had to solve th

Re: [Tutor] Python Puzzles

2005-09-17 Thread Graeme
J.Gabriel Schenz wrote: > there was a collection of Python puzzles that one could work > on, and in order to move on to the next puzzle one had to solve the > current puzzle. Are these still out there some where? You'll find the Python Challenge here - http://www.pythonchallenge.com/ Graeme __

[Tutor] Thank you all! was (Re: How do fix this error?)

2005-09-17 Thread Nathan Pinno
Hey all,   I would like to thank everyone here and at Programmer's Heaven for all their help. Thanks again!   Gratefully, Nathan Pinno - Original Message - From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; Sent: Saturday, September 17, 2005 3

Re: [Tutor] Why won't it enter the quiz?

2005-09-17 Thread Danny Yoo
On Fri, 16 Sep 2005, Nathan Pinno wrote: > cq is for "current question" and q is for "question" > therefore cq >= q should be correct most of the time Are you sure? Try specific values of current_question and question: don't just assume that it'll work: try running through the numbers. Rememb

Re: [Tutor] Multiple buttons, One callback (fwd)

2005-09-17 Thread Danny Yoo
[Forwarding to tutor, just to keep the mailing list in the loop. David, try to use your email client's Reply-To-All feature next time, so that I don't have to do this. *grin*] -- Forwarded message -- Date: Sat, 17 Sep 2005 06:24:03 -0500 From: David Kees <[EMAIL PROTECTED]> To: D

[Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Ed Hotchkiss
Ok. I am trying to read a csv file with three strings separated by commas.I am trying to insert them into a MySQL DB online.MySQLdb is installed, no problems.I think that I am having some kind of error with my csv going into the fields and being broken apart correctly. Can someone please help? Iatt

Re: [Tutor] Why won't it enter the quiz?

2005-09-17 Thread Nathan Pinno
I can see that I was wrong. I was tired, and I don't always think too smart. It should be cq <= q. :) Nathan Pinno - Original Message - From: "Danny Yoo" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]> Cc: Sent: Saturday, September 17, 2005 1:52 PM Subject: Re: [Tutor] Why won

Re: [Tutor] Why won't it enter the quiz?

2005-09-17 Thread Danny Yoo
On Sat, 17 Sep 2005, Nathan Pinno wrote: > I can see that I was wrong. I was tired, and I don't always think too > smart. It should be cq <= q. :) Hi Nathan, Yes. Here are some general tips about debugging while loops. If we have a while loop: while some_condition: ... and if

Re: [Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Danny Yoo
On Sat, 17 Sep 2005, Ed Hotchkiss wrote: > Ok. I am trying to read a csv file with three strings separated by > commas. I am trying to insert them into a MySQL DB online. MySQLdb is > installed, no problems. > > I think that I am having some kind of error with my csv going into the > fields and

Re: [Tutor] Multiple buttons, One callback (fwd)

2005-09-17 Thread Kent Johnson
Danny Yoo wrote: >>make_callback() is a function that returns a "thunk" callback. That >>returned thunk doesn't take an argument, so it's perfectly appropriate as >>a button callback. Danny, Can you explain the term 'thunk'? I'm not familiar with it and the definitions I can find don't make sen

[Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Python
You should avoid sending the connection info to the list. Google will be making this widely available. Pranksters *will* delete your tables. Change your password! Including the error info would help, but chances the following changes will fix things: stmt = """CREATE TABLE links ( ID INT NO

Re: [Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Ed Hotchkiss
  I got the mysql db just for this very purpose, that's it :P Ok heres the error which I am getting now, I dont see why your new code shouldn't work, it makes sense to me ...     >>> Traceback (most recent call last):  File "G:\Python\myCode\Links Database\addfromtext.py", line 30, in ?    cursor.e

Re: [Tutor] GetGarf (sorry, this time with attachment)

2005-09-17 Thread Ismael Garrido
Joseph Quigley wrote: >Ismael wrote: > > > >>Do you know about Dosage? It downloads lots of comics (around 500 - of >>course, you choose which ones). Among those, there's Garfield. It's >>"catchup" option will download past comics for you, and even generate >>RSS feeds and html pages if you w

Re: [Tutor] Why won't it enter the quiz? (off topic)

2005-09-17 Thread Alan G
>> Technically there may be something wrong in that if he is >> claiming copyright and selling for commerxcial gain rather > Then I recommend that Byron and anyone else interested in > this stuff go browse http://www.benedict.com/ Interesting site, thanks for pointing it out. > instead posting

Re: [Tutor] Multiple buttons, One callback (fwd)

2005-09-17 Thread Alan G
> creates the thunk callback and returns it. This returned thunk > callback > (is that a technical term or one of your own, by the way?) I'm not sure Danny is using it in the same way but I first came across the term thunk in the Win32 API. Microsoft used thunks to bridge between the new Win32 A

[Tutor] MySQLdb error - PLEASE SAVE ME

2005-09-17 Thread Python
> I dont see why your new code shouldn't work, it makes sense to me ... Danny nailed this one. He warned that your data could be short commas. You have lines with fewer than two commas. The INSERT is failing with: not enough arguments Simple fix is to skip insert if len(links) != 3. No

Re: [Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Terry Carroll
On Sat, 17 Sep 2005, Ed Hotchkiss wrote: > I think that I am having some kind of error with my csv going into the > fields and being broken apart correctly. Ed, I'd suggest using the CSV module to parse out CSV files, rather than splitting it yourself. __

Re: [Tutor] Multiple buttons, One callback (fwd)

2005-09-17 Thread Danny Yoo
> So, just to see if I understand you, I can create a function that > creates the thunk callback and returns it. This returned thunk callback > (is that a technical term or one of your own, by the way?) can then be > bound as the button's call back and will be able to remember the > parameters pa