Re: [Tutor] Strange issue w/ Python shell 3.0.0.

2013-11-23 Thread Rafael Knuth
> So, what to do about it? While the Python interactive interpreter is > mighty powerful, it does have some limitations, and this is one of them. > You just have to get used to the fact that it is not well-suited for > editing large blocks of code. It is excellent for trying out small > snippets, o

Re: [Tutor] Strange issue w/ Python shell 3.0.0.

2013-11-23 Thread Steven D'Aprano
On Sat, Nov 23, 2013 at 07:51:59PM +0100, Rafael Knuth wrote: > > Oh, wait, I see you are using Python 3.0. Don't. Python 3.0 is not > > supported because it is buggy. You should use 3.1, or better still, 3.3. > > Python 3.3 is much better than 3.1 or 3.2, and 3.0 is buggy and slow. > > What I was

Re: [Tutor] Two subsequent for loops in one function - I got it!

2013-11-23 Thread Steven D'Aprano
On Sat, Nov 23, 2013 at 08:57:54PM +0100, Rafael Knuth wrote: > I have only one question left. > Here's my original program again: > > for x in range(2, 10): > for y in range(2, x): > if x % y == 0: > print(x, "equals", y, "*", x//y) > break > else: >

Re: [Tutor] Two subsequent for loops in one function - I got it!

2013-11-23 Thread Steven D'Aprano
On Sat, Nov 23, 2013 at 09:54:38PM +0100, Rafael Knuth wrote: > > See? It has no output. By the way, the python REPL is your friend! > > Use it often when you can't figure out what is happening. > > Oh, I didn't even know that such a thing exists :-) Cool! > Unfortunately, I only found Python REP

Re: [Tutor] Depth First Search Listing all possible combinations

2013-11-23 Thread Alan Gauld
On 23/11/13 21:30, Randolph Scott-McLaughlin II wrote: Inline image 2Inline image 1Hi Tutors, So I'm writing code for a depth first search where I have 1 start point and 1 end point. Between those points there are a series of 1-way roads that goes from one vertex to the next. Sometimes the verte

Re: [Tutor] Issue w/ while loops

2013-11-23 Thread Marc Tompkins
On Sat, Nov 23, 2013 at 8:30 AM, Rafael Knuth wrote: > Marc, > > great feedback - thank you very much! > I will bear that in mind for the future. > > I modified my program as you suggested, but I received a runtime > error; I tried to fix that but unfortunately I didn't succeed. > The modified pro

Re: [Tutor] Two subsequent for loops in one function - I got it!

2013-11-23 Thread Alan Gauld
On 23/11/13 20:54, Rafael Knuth wrote: See? It has no output. By the way, the python REPL is your friend! Unfortunately, I only found Python REPLs for version 2.7.2 or lower. Is there a REPL for 3.3.0 ..? The REPL (read–eval–print loop) is the >>> prompt. You type stuff in and Python reads

Re: [Tutor] Two subsequent for loops in one function - I got it!

2013-11-23 Thread Rafael Knuth
> See? It has no output. By the way, the python REPL is your friend! Use it > often when you can't figure out what is happening. Oh, I didn't even know that such a thing exists :-) Cool! Unfortunately, I only found Python REPLs for version 2.7.2 or lower. Is there a REPL for 3.3.0 ..? Thanks, R

Re: [Tutor] Two subsequent for loops in one function - I got it!

2013-11-23 Thread Don Jennings
On Nov 23, 2013, at 2:57 PM, Rafael Knuth wrote: > > The output of > >for y in range (2,2): > > should be ... none - correct? No, it's not none. It's an empty list; thus, python executes nothing inside the inner loop. >>> range(2,2) [] >>> for y in range(2,2): ... print 'yes, I m

[Tutor] Two subsequent for loops in one function - I got it!

2013-11-23 Thread Rafael Knuth
@Peter @Steven @Don @Danny thank you *so much" for explaining the concept of a nested for loop! Your simplified example Steven made it very clear to me: for x in range(2, 7): print("outer loop, x =", x) for y in range(2, x): print("inner loop, x =", x, "y =", y) I have only one q

Re: [Tutor] Strange issue w/ Python shell 3.0.0.

2013-11-23 Thread Rafael Knuth
> Oh, wait, I see you are using Python 3.0. Don't. Python 3.0 is not > supported because it is buggy. You should use 3.1, or better still, 3.3. > Python 3.3 is much better than 3.1 or 3.2, and 3.0 is buggy and slow. What I was trying to say is that sometimes I get runtime errors even if nothing's

Re: [Tutor] Strange issue w/ Python shell 3.0.0.

2013-11-23 Thread Steven D'Aprano
On Sat, Nov 23, 2013 at 06:44:43PM +0100, Rafael Knuth wrote: > Hej there, > > I noticed that sometimes when I do lots of modifications within a > program, I get runtime errors even if the program is "clean". I > realized that first time when I copy and pasted a program into a new > window - it mi

[Tutor] Strange issue w/ Python shell 3.0.0.

2013-11-23 Thread Rafael Knuth
Hej there, I noticed that sometimes when I do lots of modifications within a program, I get runtime errors even if the program is "clean". I realized that first time when I copy and pasted a program into a new window - it miraculously ran without any problems. Although it was exactly the same prog

Re: [Tutor] raw input program is still running.

2013-11-23 Thread Satheesan Varier
; My aim is load the numerical data from this file to a c++ program to > > process this information. > > > > Thanks in advance. > > > > -Ruben. > > > > I'm sorry but we don't write code for you here. I suggest that you > start out by re

Re: [Tutor] Is there a package to "un-mangle" characters?

2013-11-23 Thread Albert-Jan Roskam
On Fri, 11/22/13, Steven D'Aprano wrote: Subject: Re: [Tutor] Is there a package to "un-mangle" characters? To: tutor@python.org Date: Friday, November 22, 2013, 4:30 PM On Thu, Nov 21, 2013 at 12:04:19PM -0800, Albert-Jan Roskam wrote: > Hi,