Kartiki
Kartiki

Reputation: 95

Indent error in iron python

flucommands = """
Library:
    CEL:
    &replace EXPRESSIONS:
    MassFlowRate = """

flucommands = flucommands + 0.43 + "[kg s^-1]"

flucommands = flucommands + """
Temp = """

flucommands = flucommands + 843.15 + "[K]"

counttt = 1
while (counttt<=3):
flucommands = flucommands + "PorositySub" + countt 
flucommands = flucommands + " = " + 0.75 + "\n" 
counttt = counttt + 1

i get error

'flucommands = flucommands + "PorositySub" + countt' error is 'expect an indented block'

Any help is appreciated. Thanks!!!

Upvotes: 0

Views: 293

Answers (1)

EdChum
EdChum

Reputation: 394339

This needs indenting:

while (counttt<=3):
    flucommands = flucommands + "PorositySub" + countt 
    flucommands = flucommands + " = " + 0.75 + "\n" 
    counttt = counttt + 1

python uses indentation instead of braces (in some other languages) for statement blocks.

Without this your while: loop is not defined hence the error you received.

See: http://www.tutorialspoint.com/python/python_while_loop.htm and https://docs.python.org/2.3/ref/indentation.html

Upvotes: 3

Related Questions