New Guy

Michael Geary Mike at DeleteThis.Geary.com
Wed Nov 19 02:56:41 EST 2003


Is that the *exact* program? Nothing is indented, so I get this error, as I
would expect:

  File "C:\TempTest\Test.py", line 11
    gen=gen+1
      ^
IndentationError: expected an indented block

If I indent everything following the "while" statement, then I get this
error which I would also expect, because the line after the "if" statement
is not indented:

  File "C:\Test\PythonTest\Test.py", line 21
    a=e
    ^
IndentationError: expected an indented block

Do those errors resemble the ones you are getting?

Could I make a couple of suggestions, which I think were already made? When
you post some code asking for advice about an error message, post the exact
code and the exact error message. Don't just say you got an error on an "if"
statement. That doesn't give anyone much to go on.

As it is, there's no way to tell if you simply didn't indent anything as
required, or you did indent your code properly but somehow the formatting
got stripped out when you posted the code. If you used tabs to format your
code, redo it with spaces instead--that will make sure it gets posted
correctly.

Also, it would be helpful if you could use "subject" lines that describe the
problem, and take a couple of minutes and proofread what you post. I'm not
just being picky here--when there are so many spelling errors, it slows
people down who read your message and may actually discourage people from
helping you out. So it's to your benefit to dot your i's and cross your t's.
Read the "how to ask questions the smart way" page that someone referred you
to earlier--it really has some good advice that you'll find useful.

-Mike

"nards_collective" <nards_collective at yahoo.com.au> wrote in message
news:mailman.865.1069224343.702.python-list at python.org...
> Thanks for the advise gys, but I still can't decipher the problem.
> Below is a copy of the entir progra, the erro is stil in the first
> 'if' command.
>
> NArDS
>
>
>
>
> a = input ("Value for A? ")
> b = input ("Value for B? ")
> c = input ("Value for C? ")
> d = input ("Value for D? ")
> gen=0
>
> print gen,a,b,c,d
>
> 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
>
> if b>= 1 :
> b=f
> else:
> b=0
>
> if g >= 1:
> c=g
> else:
> c=0
>
> if h >= 1:
> d=h
> else:
> d=0
>
> i=a/(a+b+c+d)*100
> j=b/(a+b+c+d)*100
> k=c/(a+b+c+d)*100
> l=d/(a+b+c+d)*100
>
> a = i
> b = j
> c = k
> d = l
>
> print gen,a,b,c,d
>
>






More information about the Python-list mailing list