Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Scott W Dunning
On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: Scott W Dunning swdunn...@cox.net Wrote in message: Would you please stop posting in html? I don’t know what you mean? I just use the text for my email provider. It’s not html? I types up the code I had in the

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Scott W Dunning
On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: Where are you guys using the forum? Through google? I was using that at first but someone complained about something that google does and told me to get it through my email. That’s what I’m doing now and I get bombarded with

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Alan Gauld
On 11/03/14 07:42, Scott W Dunning wrote: On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: Where are you guys using the forum? Personally I use the news feed from Gmane.org I read it in Thunderbird (or occasionally via a newsreader on my smartphone/tablet). You can also read

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Alan Gauld
On 11/03/14 04:07, Scott W Dunning wrote: On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com mailto:denis.s...@gmail.com wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread spir
On 03/11/2014 04:32 AM, Scott W Dunning wrote: On Mar 8, 2014, at 11:50 AM, Scott dunning swdunn...@cox.net wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread spir
On 03/11/2014 09:57 AM, Alan Gauld wrote: On 11/03/14 04:07, Scott W Dunning wrote: On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com mailto:denis.s...@gmail.com wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread spir
On 03/11/2014 05:07 AM, Scott W Dunning wrote: On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com wrote: Well done. And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Scott W Dunning
On Mar 11, 2014, at 1:49 AM, Alan Gauld alan.ga...@btinternet.com wrote: Not from the tutor list though. It only has a few mails normally - less than 50 most days. Actually now that you say that most of the emails are coming through the reg python-lists, not the tutor section. I guess I

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread William Ray Wing
On Mar 11, 2014, at 8:06 PM, Scott W Dunning swdunn...@cox.net wrote: [mega byte] Yeah, I had no idea that my messages were coming through in HTML, nor what it looked like until someone sent me a section showing me what it looked like, I can see how that would be frustrating. I’m

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 7:29 AM, eryksun eryk...@gmail.com wrote: i.e. guess 1 or guess 100 becomes not not (guess 1 or guess 100) Why a not not? Wouldn’t that just be saying do this because the second not is undoing the first? distribute over the disjunction not (not

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 7:35 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I have no interest in the efficiency, only what is easiest for me to read, which in this case is the chained comparison. As a rule of thumb I'd also prefer it to be logically correct :) What exactly is ment by a

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Mark Lawrence
On 10/03/2014 02:05, Scott W Dunning wrote: On Mar 8, 2014, at 7:35 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I have no interest in the efficiency, only what is easiest for me to read, which in this case is the chained comparison. As a rule of thumb I'd also prefer it to be

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Mark Lawrence
On 10/03/2014 02:03, Scott W Dunning wrote: On Mar 8, 2014, at 7:29 AM, eryksun eryk...@gmail.com wrote: Anyway, you needn't go out of your way to rewrite the expression using a chained comparison. The disjunctive expression is actually implemented more efficiently by CPython's compiler, which

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread eryksun
On Mon, Mar 10, 2014 at 5:29 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: As a newbie don't worry about it (yet). Personally I think it's plain daft to put such advanced language topics on a tutor mailing list. Different strokes for different folks. I like to tinker with and disassemble

Re: [Tutor] help me

2014-03-10 Thread hind fathallah
hi I need your help plz with this cods ( I want u to  tell wht cod I miss to stop the while loop whene I get 3 stars)  rm = [] stars = 0 ##if stars == 3: ##    print You win ##else: ##    print hh def ask_yes_no(question):     Ask a yes or no question.     answer = None        while answer not

Re: [Tutor] help me

2014-03-10 Thread Dave Angel
hind fathallah hind_fathal...@yahoo.com Wrote in message: while rm != stars:         print\                 0 - Northe         1 - South         2 - East         3 - Weast                 rm = raw_input(What room you want to go?: ) Why are you looping till

Re: [Tutor] help me

2014-03-10 Thread Peter Otten
hind fathallah wrote: hi I need your help plz with this cods ( I want u to tell wht cod I miss to stop the while loop whene I get 3 stars) rm = [] I think you are comparing a string and an integer. That gives False even if the values look the same: i = 3 s = 3 print i, s 3 3 i == s

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 10, 2014, at 4:15 AM, eryksun eryk...@gmail.com wrote: Different strokes for different folks. I like to tinker with and disassemble things as I'm learning about them. I would have been ecstatic about open source as a kid. I learn simultaneously from the top down and bottom up --

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com wrote: Well done. And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your hot/cold/warm tests together. So below is what I

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 11:50 AM, Scott dunning swdunn...@cox.net wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your hot/cold/warm tests together. I’m having a hard time

Re: [Tutor] Help with Guess the number script

2014-03-09 Thread eryksun
On Mar 8, 2014, at 7:29 AM, eryksun eryk...@gmail.com wrote: not not (guess 1 or guess 100) Why a not not? Wouldn’t that just be saying do this because the second not is undoing the first? In boolean algebra, `not (A or B)` is equivalent to `not A and not B` (De Morgan's law). I

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott W Dunning
On Mar 7, 2014, at 11:02 AM, Alan Gauld alan.ga...@btinternet.com wrote: GOT IT!! Finally! Thanks for all of your help!! This is what I got, not sure if it’s correct but it’s working! def print_hints(secret, guess): if guess 1 or guess 100: print print Out of range!

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Alan Gauld
On 08/03/14 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld alan.ga...@btinternet.com wrote: GOT IT!! Finally! Thanks for all of your help!! This is what I got, not sure if it’s correct but it’s working! Well done. And now that you have the right set of tests you can

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread spir
On 03/08/2014 10:13 AM, Alan Gauld wrote: On 08/03/14 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld alan.ga...@btinternet.com wrote: GOT IT!! Finally! Thanks for all of your help!! This is what I got, not sure if it’s correct but it’s working! Well done. And now

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Mark Lawrence
On 08/03/2014 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld alan.ga...@btinternet.com wrote: GOT IT!! Finally! Thanks for all of your help!! If at first you don't succeed... :) This is what I got, not sure if it’s correct but it’s working! def

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Dave Angel
Mark Lawrence breamore...@yahoo.co.uk Wrote in message: On 08/03/2014 01:23, Scott W Dunning wrote: def print_hints(secret, guess): if guess 1 or guess 100: Only now do I feel that it's time to point out that the above line would probably be written by an experienced Python

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread eryksun
On Sat, Mar 8, 2014 at 8:36 AM, Dave Angel da...@davea.name wrote: Mark Lawrence breamore...@yahoo.co.uk Wrote in message: On 08/03/2014 01:23, Scott W Dunning wrote: def print_hints(secret, guess): if guess 1 or guess 100: Only now do I feel that it's time to point out that the

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Mark Lawrence
On 08/03/2014 14:29, eryksun wrote: Anyway, you needn't go out of your way to rewrite the expression using a chained comparison. The disjunctive expression is actually implemented more efficiently by CPython's compiler, which you can verify using the dis module to disassemble the bytecode. I

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott dunning
On Mar 8, 2014, at 6:36 AM, Dave Angel da...@davea.name wrote: Mark Lawrence breamore...@yahoo.co.uk Wrote in message: On 08/03/2014 01:23, Scott W Dunning wrote: def print_hints(secret, guess): if guess 1 or guess 100: Only now do I feel that it's time to point out that the

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott dunning
On Mar 8, 2014, at 6:26 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 08/03/2014 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld alan.ga...@btinternet.com wrote: GOT IT!! Finally! Thanks for all of your help!! If at first you don't succeed... :)

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread Scott dunning
On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com wrote: On 03/08/2014 10:13 AM, Alan Gauld wrote: On 08/03/14 01:23, Scott W Dunning wrote: On Mar 7, 2014, at 11:02 AM, Alan Gauld alan.ga...@btinternet.com wrote: GOT IT!! Finally! Thanks for all of your help!! This is what I

Re: [Tutor] Help with Guess the number script

2014-03-08 Thread eryksun
On Sat, Mar 8, 2014 at 1:44 PM, Scott dunning swdunn...@cox.net wrote: if 1 guess 100: OH! I see what you're saying, ignore my last post. Yes that looks cleaner. Please read section 6.9 of the language reference, which defines Python comparison expressions.

[Tutor] Help with Guess the number script

2014-03-07 Thread Scott W Dunning
I am trying to write a script for class for a game called guess the number. I’m almost done but, I’m having a hard time getting the hints to print correctly. I’ve tried ‘if’’ ‘elif’ nested, it seems like everything….I’m posting my code for the hints below, any help is greatly appreciated!

Re: [Tutor] Help with Guess the number script

2014-03-07 Thread Danny Yoo
Can you split the conditions so that they're not overlapping? One of the things that you learn about programming is that if the program is hard for humans to read, even if the program is computing something useful, you may want to work to make it humanly understandable, even if the human is

Re: [Tutor] Help with Guess the number script

2014-03-07 Thread Ben Finney
Scott W Dunning swdunn...@cox.net writes: I am trying to write a script for class for a game called guess the number. I’m almost done but, I’m having a hard time getting the hints to print correctly. I’ve tried ‘if’’ ‘elif’ nested, it seems like everything…. And, what happens? Please

Re: [Tutor] Help with Guess the number script

2014-03-07 Thread Danny Yoo
One more note: I used round parenthesis in the diagrams above to indicate intervals. If you think about it a bit, you'll realize I should be using square brackets in some places, or make some distinctive graphic. Open and closed circles, perhaps? Otherwise, there are tiny pinpoint gaps in the

Re: [Tutor] Help with Guess the number script

2014-03-07 Thread Peter Otten
Scott W Dunning wrote: I am trying to write a script for class for a game called guess the number. I’m almost done but, I’m having a hard time getting the hints to print correctly. I’ve tried ‘if’’ ‘elif’ nested, it seems like everything….I’m posting my code for the hints below, any help is

Re: [Tutor] Help with Guess the number script

2014-03-07 Thread spir
On 03/07/2014 06:30 AM, Scott W Dunning wrote: I am trying to write a script for class for a game called guess the number. I’m almost done but, I’m having a hard time getting the hints to print correctly. I’ve tried ‘if’’ ‘elif’ nested, it seems like everything….I’m posting my code for the

Re: [Tutor] Help with Guess the number script

2014-03-07 Thread Alan Gauld
On 07/03/14 05:30, Scott W Dunning wrote: I am trying to write a script for class for a game called guess the number. Others have given general hints here are a couple of specifics... def print_hints(secret, guess): if guess 1 or guess 101: As I recall the spec said guesses could be

Re: [Tutor] Help with Guess the number script

2014-03-04 Thread Danny Yoo
Once a function gets beyond about six or seven lines long, it's a bit hard to read, and harder to get the indentation right. You're having difficulty with the indentation, but that's often a sign that the function is too big to read comfortably. Can you break the function down into a few pieces?

Re: [Tutor] Help with Guess the number script

2014-03-04 Thread Danny Yoo
If not, then you might even try something like: # def maybe_print_cold(): if guess (secret - 10) or guess (secret - 10): print You are cold! print print Please play again!” # ... Ooops. You probably need to

Re: [Tutor] Help with Guess the number script

2014-03-04 Thread Alan Gauld
On 04/03/14 02:29, Scott W Dunning wrote: I’ve made some changes and have a couple questions, I’ll speak in between the code. from random import randrange randrange(1, 101) This call to randrange() doesn't do anything because you don't store the return value. You need to create a variable

Re: [Tutor] Help with Guess the number script

2014-03-03 Thread Ben Finney
Scott W Dunning swdunn...@cox.net writes: This is what Im having trouble with now. Here are the directions I’m stuck on and what I have so far, I’ll bold the part that’s dealing with the instructions if anyone could help me figure out where I’m going wrong. “Bold” assumes that markup of text

Re: [Tutor] Help with Guess the number script

2014-03-03 Thread spir
On 03/03/2014 05:03 AM, Scott W Dunning wrote: Ben Finney makes numerous fine comments already. I'll add a few, some on the same points but but expressed a bit differently (case it helps). This is what Im having trouble with now. Here are the directions I’m stuck on and what I have so far,

Re: [Tutor] Help with Guess the number script

2014-03-02 Thread Dave Angel
Scott W Dunning swdunn...@cox.net Wrote in message: On Mar 1, 2014, at 12:47 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: You've bound the name ‘current_guess’ to the user's input, but then do nothing with it for the rest of the function; it will be discarded without being used.

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread Dave Angel
Scott W Dunning swdunn...@cox.net Wrote in message: In addition to Ben's observation, you don't use anything random when initializing secret. And you don't store the result of get_guess. -- DaveA ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread spir
On 03/01/2014 07:46 AM, Scott W Dunning wrote: Hello, i am working on a project for learning python and I’m stuck. The directions are confusing me. Please keep in mind I’m very ne to this. The directions are long so I’ll just add the paragraphs I’m confused about and my code if someone

Re: [Tutor] Help with Guess the Number script

2014-03-01 Thread Mark Lawrence
On 01/03/2014 06:05, Scott Dunning wrote: In addition to the answers you've already had, I suggest that you learn to run code at the interactive prompt, it's a great way of seeing precisely what snippets of code actually do. Also use the print statement in Python 2 or print function in

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread Alan Gauld
Scott W Dunning swdunn...@cox.net writes: def get_guess(guess_number): print (,guess_number,)Plese enter a guess: Aren't you missing a comma before the last string? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread Alan Gauld
On 01/03/14 17:16, Alan Gauld wrote: Scott W Dunning swdunn...@cox.net writes: def get_guess(guess_number): print (,guess_number,)Plese enter a guess: Aren't you missing a comma before the last string? I just realized it will work because Python auto joins adjacent string literals.

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread Scott W Dunning
On Mar 1, 2014, at 12:47 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: You've bound the name ‘current_guess’ to the user's input, but then do nothing with it for the rest of the function; it will be discarded without being used. Hmm, I’m not quite sure I understand. I got somewhat

Re: [Tutor] Help with Guess the Number script

2014-03-01 Thread Scott W Dunning
On Mar 1, 2014, at 8:57 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 01/03/2014 06:05, Scott Dunning wrote: In addition to the answers you've already had, I suggest that you learn to run code at the interactive prompt, it's a great way of seeing precisely what snippets of code

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread Scott W Dunning
On Mar 1, 2014, at 6:53 AM, spir denis.s...@gmail.com wrote: I find directions very confusing. Also, they completely control you while explaining about nothing, like a user manual saying press this, turn that. This is inappropriate for programming (and anything else): you need to

Re: [Tutor] Help with Guess the number script

2014-03-01 Thread Ben Finney
Scott W Dunning swdunn...@cox.net writes: On Mar 1, 2014, at 12:47 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: You've bound the name ‘current_guess’ to the user's input, but then do nothing with it for the rest of the function; it will be discarded without being used. Hmm, I’m not

[Tutor] Help with Guess the number script

2014-02-28 Thread Scott W Dunning
Hello, i am working on a project for learning python and I’m stuck. The directions are confusing me. Please keep in mind I’m very ne to this. The directions are long so I’ll just add the paragraphs I’m confused about and my code if someone could help me out I’d greatly appreciate it! Also,

Re: [Tutor] Help with Guess the number script

2014-02-28 Thread Ben Finney
Scott W Dunning swdunn...@cox.net writes: def get_guess(guess_number): print (,guess_number,)Plese enter a guess: current_guess = raw_input() return int(guess_number) You've bound the name ‘current_guess’ to the user's input, but then do nothing with it for the rest of the

Re: [Tutor] help me

2014-02-02 Thread hind fathallah
thank you so much because I got it :)  On Saturday, February 1, 2014 1:28 PM, Danny Yoo d...@hashcollision.org wrote: On Fri, Jan 31, 2014 at 8:55 PM, hind fathallah hind_fathal...@yahoo.com wrote: hi can you answer this question for me plz [question omitted] Many of us probably could

[Tutor] help me

2014-02-01 Thread hind fathallah
hi can you answer this question for me plz   Modify the Guess My number program from this chapter so that the player has only five guesses. If the player run out of guess, the program should end the game and display an appropriately chastising message. 

Re: [Tutor] help me

2014-02-01 Thread Mark Lawrence
On 01/02/2014 04:55, hind fathallah wrote: hi can you answer this question for me plz Modify the Guess My number program from this chapter so that the player has only five guesses. If the player run out of guess, the program should end the game and display an appropriately chastising message.

Re: [Tutor] help me

2014-02-01 Thread Danny Yoo
On Fri, Jan 31, 2014 at 8:55 PM, hind fathallah hind_fathal...@yahoo.com wrote: hi can you answer this question for me plz [question omitted] Many of us probably could answer this. But this is not a homework-answering mailing list. The problem itself is not interesting to us. What is

[Tutor] help with data insert into Access table

2014-01-29 Thread Ahmed, Shakir
Hi, I am trying to insert a record in the access table, the value has a quote and could not insert the record. Any idea how I can insert records like this quotes. Thanks S cursor.execute(INSERT INTO PicsPostInfo(Pics_name) values ('Site Name's Harbor.JPG')) Traceback (most recent call last):

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread Peter Otten
Ahmed, Shakir wrote: I am trying to insert a record in the access table, the value has a quote and could not insert the record. Any idea how I can insert records like this quotes. cursor.execute(INSERT INTO PicsPostInfo(Pics_name) values ('Site Name's Harbor.JPG')) Traceback (most recent

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread Mark Lawrence
On 29/01/2014 16:46, Peter Otten wrote: Ahmed, Shakir wrote: I am trying to insert a record in the access table, the value has a quote and could not insert the record. Any idea how I can insert records like this quotes. cursor.execute(INSERT INTO PicsPostInfo(Pics_name) values ('Site Name's

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread Ahmed, Shakir
Thanks, it worked exactly what I was trying to do so. -Original Message- From: Tutor [mailto:tutor-bounces+shahmed=sfwmd@python.org] On Behalf Of Peter Otten Sent: Wednesday, January 29, 2014 11:47 AM To: tutor@python.org Subject: Re: [Tutor] help with data insert into Access table

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread Keith Winston
On Wed, Jan 29, 2014 at 12:11 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: I think it's worth pointing out that there is a difference here between the OP's 'Site Name's Harbor.JPG' and Peter's Site Name's Harbor.JPG. Left as homework for the newbies :) I'll bite. But are you just

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread Mark Lawrence
On 29/01/2014 19:47, Keith Winston wrote: On Wed, Jan 29, 2014 at 12:11 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: I think it's worth pointing out that there is a difference here between the OP's 'Site Name's Harbor.JPG' and Peter's Site Name's Harbor.JPG. Left as homework for the

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread Keith Winston
On Wed, Jan 29, 2014 at 3:03 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Nothing to do with tuples. Tools such as syntax checkers or MkI eyeballs come in useful here. Although such tools probably won't pick up the incorrect spelling of harboUr :) Alas, now I'm more confused. I don't see

Re: [Tutor] help with data insert into Access table

2014-01-29 Thread eryksun
On Wed, Jan 29, 2014 at 3:53 PM, Keith Winston keithw...@gmail.com wrote: I had the impression that Peter was employing tuples because, as an immutable type, it couldn't inadvertently/inauspiciously be changed by a user Per footnote 5 of PEP 249, the parameters need to be in a type that

[Tutor] help

2014-01-09 Thread Tihomir Zjajic
Please, can you help me convert this code from python 3 to python 2.6 g = input(Enter a vrs_drv:) vrs_drv = int(g) def vrs_drv(): vrs_drv = input(Enter a vrs_drv:) if vrs_drv == 21: return(1) if vrs_drv == 22: return(2) if vrs_drv == 41: return(4) number1 =

Re: [Tutor] help

2014-01-09 Thread Steven D'Aprano
On Thu, Jan 09, 2014 at 09:52:04AM +0100, Tihomir Zjajic wrote: Please, can you help me convert this code from python 3 to python 2.6 Change input() to raw_input(). That will make it compatible with Python 2.6. But that is not the cause of the error you get. The error that you get is that your

Re: [Tutor] help

2014-01-09 Thread Alan Gauld
On 09/01/14 08:52, Tihomir Zjajic wrote: Please, can you help me convert this code from python 3 to python 2.6 The main gotchas are that 1) input in Python 3 - raw_input() in Python 2 2) print (XXX) in Python 3 - print XXX in Python 2 Start from there then read any error messages and fix as

[Tutor] Help with python

2013-12-02 Thread Blake
I'm writing a program to calculate totals and change for a menu, and I'm having a few issues. If you could help me, it would be greatly appreciated. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Help with python

2013-12-02 Thread Mark Lawrence
On 02/12/2013 22:33, Blake wrote: I'm writing a program to calculate totals and change for a menu, and I'm having a few issues. If you could help me, it would be greatly appreciated. A little more data would help :) Some code, the OS and Python versions and the precise nature of the

Re: [Tutor] Help with python

2013-12-02 Thread Steven D'Aprano
On Mon, Dec 02, 2013 at 04:33:27PM -0600, Blake wrote: I'm writing a program to calculate totals and change for a menu, and I'm having a few issues. If you could help me, it would be greatly appreciated. Would you like us to guess what issues you are having? Let me look into my crystal

Re: [Tutor] Help merge files using python

2013-11-15 Thread Peter Otten
jarod...@libero.it wrote: Hi I want to merge many files like this: #file1 A 10 B 20 C 30 #file2 B 45 Z 10 #file1 A 60 B 70 C 10 I want to obtain A 10 0 60 B 20 45 70 C 30 0 10 Z 0 10 0 I try to do like this: f = os.listdir(.) for i in f:

[Tutor] Help merge files using python

2013-11-13 Thread jarod...@libero.it
Hi I want to merge many files like this: #file1 A 10 B 20 C 30 #file2 B 45 Z 10 #file1 A 60 B 70 C 10 I want to obtain A 10 0 60 B 20 45 70 C 30 0 10 Z 0 10 0 I try to do like this: f = os.listdir(.) for i in f: T =open(i,r) for r in

Re: [Tutor] Help merge files using python

2013-11-13 Thread Amit Saha
On Thu, Nov 14, 2013 at 8:26 AM, jarod...@libero.it jarod...@libero.it wrote: Hi I want to merge many files like this: #file1 A 10 B 20 C 30 #file2 B 45 Z 10 #file1 A 60 B 70 C 10 I want to obtain A 10 0 60 B 20 45 70 C 30 0 10 Z 0

Re: [Tutor] Help merge files using python

2013-11-13 Thread Alan Gauld
On 13/11/13 22:26, jarod...@libero.it wrote: I want to obtain A 10 0 60 B 20 45 70 C 30 0 10 Z 0 10 0 Amit has given you a design to solve the problem, however based on your code you may not be able to translate that into code yet. I try to do like this: f = os.listdir(.) for i in f: T

[Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Hi Everyone, I hope you're having a great week. I'm working on this program that converts strings to integers. Can someone please help me out? :) Below is the program: def main():selection = input(Enter you choice. Enter 1 + for Phone Translator or 2 for Backward String.)

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/30/2013 10:00 PM, Carmen Salcedo wrote: Hi Everyone, hi some guidelines for this list. post in plain text not html. tell us what version of Python you are using, what OS, what you use to edit and run the program. when replying: reply-all so a copy goes to the list put

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 6:49 AM, Carmen Salcedo wrote: Hi, I'm using python 2.7. I'm editing the program with idle. I use windows 8. I finally got the string to convert to integers, however I can't figure out how to print them in this phone number format555-5678 tel:555-5678. The numbers are

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 7:52 AM, Carmen Salcedo wrote: I'm not able to post it right now. All I did to the previous program i emailed was changed isalpha() to str.isalpha. That does agree with what you posted or got. The part of your original program that should print a character already is print

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Mark Lawrence
On 31/10/2013 02:00, Carmen Salcedo wrote: Hi Everyone, I hope you're having a great week. I'm working on this program that converts strings to integers. Can someone please help me out? :) Below is the program: def main(): selection = input(Enter you choice. Enter 1 +

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 10:11 AM, Carmen Salcedo wrote: Thanks Bob! :) A list is great idea. I'm just trying to figure out how to print the number across like a phone number 555- instead of downward. I'm stuck on that. I repeat what I said before: There are many ways to get the desired output.

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 10:11 AM, Carmen Salcedo wrote: I'm just trying to figure out how to print the number across like a phone number 555- instead of downward. I'm stuck on that. On further thought: print %s%s%s-%s%s%s%s % tuple(numberList) The % operator does formatting. Each %s is replaced

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
I'm not able to post it right now. All I did to the previous program i emailed was changed isalpha() to str.isalpha. Thanks Sent from my iPhone On Oct 31, 2013, at 7:09 AM, bob gailer bgai...@gmail.com wrote: On 10/31/2013 6:49 AM, Carmen Salcedo wrote: Hi, I'm using python 2.7. I'm

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Hi, I'm using python 2.7. I'm editing the program with idle. I use windows 8. I finally got the string to convert to integers, however I can't figure out how to print them in this phone number format 555-5678. The numbers are printing out this way. 5 5 5 5 6 Thank you very much. :) Carmen

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Thanks Bob! :) A list is great idea. I'm just trying to figure out how to print the number across like a phone number 555- instead of downward. I'm stuck on that. 5 5 5 Thanks again! Carmen Sent from my iPhone On Oct 31, 2013, at 9:02 AM, bob gailer bgai...@gmail.com wrote: On

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Hi Mark, Thanks for the feedback. I figured it out. Yes, I'm using python 2.7 (typo in the last email). Have a great day. Sent from my iPhone On Oct 31, 2013, at 10:44 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 31/10/2013 02:00, Carmen Salcedo wrote: Hi Everyone, I hope you're

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Thanks Bob! :) I'm very new at programming in Python. I appreciate your feedback. Have a great week! Sent from my iPhone On Oct 31, 2013, at 1:07 PM, bob gailer bgai...@gmail.com wrote: On 10/31/2013 10:11 AM, Carmen Salcedo wrote: Thanks Bob! :) A list is great idea. I'm just trying to

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 2:51 PM, Carmen Salcedo wrote: Thanks Bob! :) I'm very new at programming in Python. I appreciate your feedback. Here are some improvements to consider: import string def main(): d = {1 : phoneTranslator, 2 : backwardString} # map user selection to corresponding function

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Mark Lawrence
On 01/11/2013 02:36, bob gailer wrote: On 10/31/2013 2:51 PM, Carmen Salcedo wrote: Thanks Bob! :) I'm very new at programming in Python. I appreciate your feedback. Here are some improvements to consider: import string def main(): d = {1 : phoneTranslator, 2 : backwardString} # map

[Tutor] Help please

2013-10-17 Thread Pinedo, Ruben A
I was given this code and I need to modify it so that it will: #1. Error handling for the files to ensure reading only .txt file #2. Print a range of top words... ex: print top 10-20 words #3. Print only the words with 3 characters #4. Modify the printing function to print top 1 or 2 or 3

Re: [Tutor] Help please

2013-10-17 Thread Todd Matsumoto
Hello Ruben, You might already know this, but the Python documentation will get you pretty far: http://www.python.org/doc/ Here are some things to lookup that may help you solve the problems. On 10/16/2013 08:49 PM, Pinedo, Ruben A wrote: I was given this code and I need to modify it so

Re: [Tutor] Help please

2013-10-17 Thread Alan Gauld
On 16/10/13 19:49, Pinedo, Ruben A wrote: I was given this code and I need to modify it so that it will: #1. Error handling for the files to ensure reading only .txt file I'm not sure what is meant here since your code only ever opens 'emma.txt', so it is presumably a text file... Or are you

Re: [Tutor] Help please

2013-10-17 Thread Peter Otten
Alan Gauld wrote: [Ruben Pinedo] def process_file(filename): hist = dict() fp = open(filename) for line in fp: process_line(line, hist) return hist def process_line(line, hist): line = line.replace('-', ' ') for word in line.split(): word =

Re: [Tutor] Help please

2013-10-17 Thread Dominik George
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Todd Matsumoto c.t.matsum...@gmail.com schrieb: #1. Error handling for the files to ensure reading only .txt file Look up exceptions. Find out what the string method endswith() does. One should note that the OP probably meant files of the type

Re: [Tutor] Help please

2013-10-17 Thread Kengesbayev, Askar
#2. Thanks, Askar From: Pinedo, Ruben A [mailto:rapin...@miners.utep.edu] Sent: Wednesday, October 16, 2013 2:49 PM To: tutor@python.org Subject: [Tutor] Help please I was given this code and I need to modify it so that it will: #1. Error handling for the files to ensure reading only .txt file #2

Re: [Tutor] Help please

2013-10-17 Thread Alan Gauld
On 17/10/13 14:37, Peter Otten wrote: Alan Gauld wrote: [Ruben Pinedo] def process_file(filename): hist = dict() fp = open(filename) for line in fp: process_line(line, hist) return hist or somebody is just sloppy. But neither work as expected right now. (Hint:

[Tutor] Help Beginning

2013-10-08 Thread Connor Moody
Hello, I'm starting off programing with python and i like it (so far). Im having trouble finding a website that simply teaches it. I have never programmed before and i thought this would be a great place to start. What websites should I use to start off? Sent from my iPad

<    1   2   3   4   5   6   7   8   9   10   >