Re: [Tutor] Trivia

2011-06-30 Thread Christopher King
Just some programming philosophy. On Fri, Jun 24, 2011 at 3:58 AM, Vincent Balmori wrote: > > "Your whole approach is very fragile in this respect, it only > takes one small mistake in the data to wreck your program,. > Somethjing like a config file format would be much more > robust (and readabl

Re: [Tutor] Trivia

2011-06-24 Thread Alan Gauld
"Vincent Balmori" wrote Can you please explain more on what you mean by this? "Your whole approach is very fragile in this respect, it only takes one small mistake in the data to wreck your program,. Your program relies on your data being exactly right. It only takes one missed newline,

Re: [Tutor] Trivia

2011-06-24 Thread Vincent Balmori
"Your whole approach is very fragile in this respect, it only takes one small mistake in the data to wreck your program,. Somethjing like a config file format would be much more robust (and readable) the config reader module would make sure you got what you expected back. " Can you please exp

Re: [Tutor] Trivia

2011-06-24 Thread Alan Gauld
"Vincent Balmori" wrote It's working fine now with the scoring, but now at the end of the program for some reason I get this error message: "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07/trivia_challenge2.py", line 27, in next_block point = int(next_line(the_file)) ValueErr

Re: [Tutor] Trivia

2011-06-24 Thread Andre Engels
On Fri, Jun 24, 2011 at 8:56 AM, Vincent Balmori wrote: > > << > point = int(next_line(the_file)) > > If x is a string that can be interpreted as an integer number, int(x) is > that integer number; if the string is not the representation of an integer, > this will lead to a ValueError. > > -- > An

Re: [Tutor] Trivia

2011-06-23 Thread Vincent Balmori
<<>> It's working fine now with the scoring, but now at the end of the program for some reason I get this error message: Traceback (most recent call last): File "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07/trivia_challenge2.py", line 83, in main() File "/Users/vincentbal

Re: [Tutor] Trivia

2011-06-23 Thread Vincent Balmori
***ignore the "point = point" line in the next_block() function. -- View this message in context: http://old.nabble.com/Trivia-tp31917610p31917637.html Sent from the Python - tutor mailing list archive at Nabble.com. ___ Tutor maillist - Tutor@pytho

[Tutor] Trivia

2011-06-23 Thread Vincent Balmori
I have to improve the trivia_challenge program so each question has a different point value. I added a point into the text file after each category line, so the next_block() can call it. Whenever the program calculates the 'score = point' in main() it comes up with "TypeError: unsupported operand

Re: [Tutor] Trivia program.

2005-02-16 Thread Liam Clarke
Or name = raw_input("Hi. What's your name? ") called = "%s " % name On Wed, 16 Feb 2005 11:46:09 +0100, Pierre Barbier de Reuille <[EMAIL PROTECTED]> wrote: > Mmmhh ... one very simple way would be to replace your first line by : > > name = raw_input("Hi. What's your name? ") + " " > > But

Re: [Tutor] Trivia program.

2005-02-16 Thread Max Noel
On Feb 16, 2005, at 10:26, . Sm0kin'_Bull wrote: it prints like...   John GoodmanJohn GoodmanJohn GoodmanJohn GoodmanJohn Goodman   But i want to print it like...   John Goodman  John Goodman  John Goodman  John Goodman  John Goodman   How can I do it? Try replacing the called = name * 5 line w

Re: [Tutor] Trivia program.

2005-02-16 Thread Pierre Barbier de Reuille
Mmmhh ... one very simple way would be to replace your first line by : name = raw_input("Hi. What's your name? ") + " " But if you want to keep the name as it is, I bet the best way is to replace your second line by : called = " ".join([ name for i in xrange(5) ]) The advantage of this second m

[Tutor] Trivia program.

2005-02-16 Thread . Sm0kin'_Bull
Hi, I got a problem with this program.     name = raw_input("Hi. What's your name? ")called = name * 5print "\nIf a small child were trying to get your attention, " \   "your name would become:"print called When i input the name like "John Goodman"   it prints like...   John GoodmanJohn Goodman