New Guy

my-first-name at hazen.net my-first-name at hazen.net
Wed Nov 19 05:54:59 EST 2003


[NArDS]
> while gen <=40 :
> 	
> 	gen=gen+1
> 	e= (b+d)/2+ (b-c)
> 	f= (a+c)/2+(b-d)
> 	g=(b+d)/2+(c-a)
> 	h=(a+c)/2+(d-b)
> 
> print gen,a,b,c,d
> print gen,e,f,g,h	
> 
> 	if e >= 1:
> 		a=e
> 	else :
> 		a=0
<snip the rest>

[Duncan]
> The problem is that you have indented the 'if' statements. You aren't 
> allowed to indent code arbitrarily in Python. Indent inside blocks, but the 
> first if statement doesn't start a new block, so it MUST be at exactly the 
> same indentation level as the preceding print statement.

While this is correct, looking at the code makes me think that
everything is intended to be in the while loop (otherwise it doesn't do
anything).

So try indenting the print statements to the same level as everything
else in the loop.  Hopefully, the results will be closer to what you
expected.

-John
(john at my-domain -- see from address)





More information about the Python-list mailing list